Help with syntax for flow.get context

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

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.

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.

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?

(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.

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.

please check my last post, you missed the data.

1 Like

Many thanks @E1cid . Works perfectly now.

image

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