JSONata use sequence index

Hello everbody,

i have a number messages which are the result of a split node. I want to use the parts.index property of this messages to set the message topics. I try to do it by a change node with the follwing JSONata code:

"/dio/" & $string($flowContext("Pins")[0][(parts.index)]) & "/value"

The flow variable Pins looks like:

Pins = [
   [11,12,13,14],
   [21,22,23,24]
]

If I replace (parts.index) with an number it works (I get the correct topic with the pin nummer looked up in Pins). If set the JSONata to parts.index only, it works, too (I get the split index as topic). But if put it together, it doesn't work. What did I miss.

Thanks for any suggestions.
L4rs

Please post what results you want from the sample input you showed.
Also post a sample flow that injects sample values into the flow context.

Here is another example of why you should tell JSONata which context you are using.

Always use $.property (current context eg in loop) or $$.property (base context eg msg)
try

/dio/" & $string($flowContext("Pins")[0][($$.parts.index)]) & "/value"