# Help with syntax for flow.get context

**URL:** <https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354>\
**Category:** General\
**Created:** [25 March 2022 18:31 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354 "2022-03-25T18:31:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [25 March 2022 18:31 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/1 "2022-03-25T18:31:52Z")

</div>

I am still trying to learn about flow context. I have set up the following:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/851b5efd5ff292939a4298850c9c938f65c6ce43.png)

I want to multiply both of the above by 30 and then send into Influx2. However, I am getting the error shown below. I have tried various other ways, such as `Feedrate: msg.data.weight_dispensed*30` and `Feedrate: flow.data.weight_dispensed*30` and nothing seems to get past this error.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/420dc71d2930e5828582c7b034585e70fd36ff67.png)

---

<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:** [25 March 2022 18:49 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/2 "2022-03-25T18:49:24Z")

</div>

flow.get("property")  
the second input (data in your case) is the context store to use.  
So data would need to be the name of the store you want to use, but you have not defined data. So you do not need data and the flow.get() would use the default context store.

---

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [25 March 2022 18:56 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/3 "2022-03-25T18:56:38Z")

</div>

Thank you. That eliminated the error, but now I am getting NaN, even though it would appear to me that I am sending a number to Influx. Any ideas for how to address this issue?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1c24040f7c64ebe94d32a2dc08b9e7f2959a697.png)

---

<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:** [25 March 2022 19:26 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/4 "2022-03-25T19:26:09Z")

</div>

```auto
(flow.get("data.target_weight_dispensed") || 0) * 30

```

The `|| 0` is a default if not defined.  
Taken from your snippets of images, may be some typo's , so check spelling.

---

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [25 March 2022 20:38 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/5 "2022-03-25T20:38:37Z")

</div>

Hmmmm....There is no more NaN, but it is defaulting to 0, even though the flow context values both read 5 at the time this was run.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/733ad2a1b0304f745ce1a7bfb3cf140eb86fa561.png)

---

<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:** [25 March 2022 20:42 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/6 "2022-03-25T20:42:41Z")

</div>

please check my last post, you missed the `data.`

---

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [25 March 2022 21:20 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/7 "2022-03-25T21:20:03Z")

</div>

Many thanks @E1cid . Works perfectly now.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/94ae63e958bcba5d13bfd41d1188850319acdfdd.png)

---

<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:** [8 April 2022 21:20 UTC](https://discourse.nodered.org/t/help-with-syntax-for-flow-get-context/60354/8 "2022-04-08T21:20:36Z")

</div>

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