JASONata $flowcontext can't get it working

Hi guys, 'm not sure if I am doing something wrong, but I can't get this simple flow to work:

[{"id":"c1d0123d.36c56","type":"inject","z":"e4a2b71d.443e78","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":660,"wires":[["980deed6.2c72a8"]]},{"id":"7a7a6264.84f094","type":"debug","z":"e4a2b71d.443e78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":680,"wires":[]},{"id":"980deed6.2c72a8","type":"change","z":"e4a2b71d.443e78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowcontext(\"calibV0\")\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":660,"wires":[["7a7a6264.84f094"]]}]

The error received: Invalid JSONata expression: Attempted to invoke a non-function

Node.js version: Node v12.19.0
NR version: 1.2.3
OS: Raspbian 10 (buster)

Please accept my apology if this is not the right place and/or the q is too trivial :flushed:
Thank you,
N.

Hi @nonix - welcome to the forum

No need to apologise - this is the right place to ask questions and there's nothing too trivial to ask when you're stuck on something.

The function you want is $flowContext not $flowcontext.

Hi, thank you for super fast reply, did not realized it is case sensitive. :blush:
However, now there is no error msg, but nothing get set anyway. e.g. it sends an empty object.

[{"id":"aaa6fba3.dd4dc","type":"inject","z":"e4a2b71d.443e78","name":"LiPo calib. Voltage/A0","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0.00496173469387755102040816326531","payloadType":"num","x":420,"y":640,"wires":[["e7d50e70.2b49e"]]},{"id":"e7d50e70.2b49e","type":"change","z":"e4a2b71d.443e78","name":"","rules":[{"t":"set","p":"cailbV0","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":640,"wires":[[]]},{"id":"88b6d266.404a48","type":"change","z":"e4a2b71d.443e78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext(\"calibV0\",\"memory\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":700,"wires":[["95689049.42786"]]},{"id":"95689049.42786","type":"debug","z":"e4a2b71d.443e78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":700,"wires":[]},{"id":"322d2a26.64ba0e","type":"inject","z":"e4a2b71d.443e78","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":360,"y":700,"wires":[["88b6d266.404a48"]]}]

I have also added the creation of the flow.context variable into this example.

Note: Not sure if any value, but need to say I have upgraded the NR from an older version (don't remember the previous ver. but about 1/2 year old)

Thank you for helping,
N.

You have a typo
calibV0
cailbV0

Well, what can I say ... thank you very much for finding my typo.

I am so embarrassed :face_with_head_bandage:

N.

Hi. Welcome to the forum.

JavaScript, JSON & JSONata are all case sensitive.

Don't fret to much we have all been there.

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