and based on the value in msg.payload I want to return the value of the 'path'. In a change node using JSONata, I can hard code the os value like: $flowContext("osPath")[os="windows"].path and it returns c:/ but I want to use msg.payload which I haven't been able to figure out. Any hints?
Since the change node exposes the full message object as $ in jsonata, try $.payload to access the payload. Typing from my phone so I can’t try it out, but see if $flowContext("osPath")[os=$.payload].path works.
If instead it were to put the flowContext as $, the message object aka the root object/input can still be accessed as $$, thus $$.payload would be my second guess.
@afelix you almost had it right. I had to use $$ in the statement $flowContext("osPath")[os=$.payload].path
Thanks for the nudge in the right direction
At the start of the expression, $$ has the input json object which in node-red means the full message object. It’s static as such, and you can always fall back to it. Once you move down the object tree, $ becomes the current object but as the flowContext is an extension to the language I wasn’t sure if it would take over the current object too.