Jsonata & Multiple context stores

Hello,

As NR allows to define multiple context stores, is there a way to select directly one of these stores with the "$globalContext()" function in a JSONata expression ?

Or should I use a change node to retrieve the data in a non-default store ?

Yes: $globalContext("variableName", "storeName")

Here is a demo...

[{"id":"3774b9ce.8fbaf6","type":"inject","z":"64ce1d00.d049e4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":740,"wires":[["a59b9f29.84eeb"]]},{"id":"a59b9f29.84eeb","type":"change","z":"64ce1d00.d049e4","name":"","rules":[{"t":"set","p":"var1","pt":"global","to":"value stored in memory store","tot":"str"},{"t":"set","p":"#:(file)::var2","pt":"global","to":"value stored in file store","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":740,"wires":[["65692d2d.e5ba04"]]},{"id":"65692d2d.e5ba04","type":"change","z":"64ce1d00.d049e4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t    \"memstore_var1\": $globalContext(\"var1\"),\t    \"filestore_var2\": $globalContext(\"var2\", \"file\")\t}\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":740,"wires":[["b78cb364.7ba0e"]]},{"id":"b78cb364.7ba0e","type":"debug","z":"64ce1d00.d049e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":930,"y":740,"wires":[]}]

Great Thanks !

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