# Flow.get syntax

**URL:** <https://discourse.nodered.org/t/flow-get-syntax/38145>\
**Category:** General\
**Created:** [28 December 2020 16:50 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145 "2020-12-28T16:50:00Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [28 December 2020 16:50 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/1 "2020-12-28T16:50:00Z")

</div>

hello,  
can someone help me with the flow.get syntax.

```auto
var shd = flow.get('schedule_G2','groupID.G2.shd_12.ontopic');
msg.payload=shd;
return msg;

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40794de37f21cda2a58872375a2a6fa140f60b9d.png)  
I only want to read this one value and I am desperate because I always get everything and not dedicated ontopic from shed\_12.  
THX

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 December 2020 16:57 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/2 "2020-12-28T16:57:49Z")

</div>

I think this should do it:

```auto
var shd = flow.get('schedule_G2.shd_12.ontopic')

```

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [28 December 2020 17:08 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/3 "2020-12-28T17:08:42Z")

</div>

> [@knolleary](#):
>
> `schedule_G2.shd_12.ontopic`

NOT SEE THE FOREST FOR THE TREES

THX

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [28 December 2020 17:09 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/4 "2020-12-28T17:09:45Z")

</div>

or

```auto
var shd = flow.get('schedule_G2').shd_12.ontopic;
msg.payload=shd;
return msg;

```

Which is faster, but unless using large objects will be unnoticable.

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [31 December 2020 14:55 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/5 "2020-12-31T14:55:23Z")

</div>

hello  
in order to optimise my code a little more and consolidate individual functions, I am wondering whether it is possible to include 12 as a variable in `var shd = flow.get('schedule_G2.shd_12.ontopic')`  
I have been trying with trial and error to figure out how to include the variable so that the flow get call still works.  
Is it possible that I can't do it directly in the call?  
THX

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [31 December 2020 15:16 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/6 "2020-12-31T15:16:54Z")

</div>

> [@edstobi](#):
>
> is possible to include 12 as a variable in `var shd = flow.get('schedule_G2.shd_12.ontopic')`

in a function...

```auto
var num = 12; // or 13 or msg.number or whatever!
var path = `schedule_G2.shd_${num}.ontopic`;
msg.payload = flow.get(path);
return msg;

```

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [31 December 2020 16:15 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/7 "2020-12-31T16:15:54Z")

</div>

learned something new again.  
THX

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [31 December 2020 16:45 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/8 "2020-12-31T16:45:06Z")

</div>

> [@Steve-Mcl](#):
>
> ``schedule\_G2.shd\_${num}.ontopic`;`

As a beginner, may I ask one more question  
I have seen that it does not work with ' ' but only with \*  
What are these called so I can search for them to understand the difference.  
I have not worked with them before

- i can't even use these characters in the forum

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2020 16:53 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/9 "2020-12-31T16:53:05Z")

</div>

> **[What is a Back Quote?](https://www.computerhope.com/jargon/b/backquot.htm?sa=X&ved=2ahUKEwjS3q6-1vjtAhUPrqQKHcfZDy8Q9QF6BAgEEAI)**
>
> Computer dictionary definition of what back quote means, including related links, information, and terms.

just escape them on forum  
to show `  
use \`

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [31 December 2020 17:05 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/10 "2020-12-31T17:05:23Z")

</div>

AHH OK. I am using a qwertz German keyboard  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8ab4eb1cd16ef7bf15a116bf0b693a2b016366b5.png)

😉 \ `

[Template\_literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [4 January 2021 10:31 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/11 "2021-01-04T10:31:23Z")

</div>

Thank you - i have two more questions:

1. work this syntax for global.get too?
2. can we use this syntax for the SET command too?

BR  
Hubertus

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 January 2021 10:50 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/12 "2021-01-04T10:50:56Z")

</div>

> [@Hubertus](#):
>
> - work this syntax for global.get too?
> - can we use this syntax for the SET command too?

Yes, same syntax works for all types of context and both get/set

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [4 January 2021 11:22 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/13 "2021-01-04T11:22:44Z")

</div>

Perfect! Thank you.

Once more: is the context protected against competing write access?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 January 2021 11:23 UTC](https://discourse.nodered.org/t/flow-get-syntax/38145/14 "2021-01-18T11:23:17Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
