$flowContext with req.params?

I have a flow context object called testobject:

{
 test1:[{some content..}],
 test2:[{some other content..}]
}

I want to use a change node to return the property that was requested via req.params.item

req.params.item = 'test1'

In jsonata, I would think the following:
$flowContext("testobject")[req.params.item]

but this does not return anything, what am I missing ?

I'm not a jsonata fan (or regular user of it) but I am not sure property access via square brackets is supported?

Try

$lookup($flowContext("testobject"), req.params.item)

Far easier in function node (as I am certain you know)

You might also be able to simply chose flow (instead of jsonata) and enter testobject[msg.req.params.item] in the field.

You might also be able to simply chose flow (instead of jsonata) and enter testobject[msg.req.params.item] in the field.

Interesting, I was not aware, very nice indeed. I was complicating things I see.

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