Allow target to be also a jsonata expression

Sometimes it would be handy to dynamically define not only the source but also the target field in a change node.

So the "set" option should be extended with the jsonata expression.

So what happens if the JSONata expression returns [1,2,3] - what should we set?

It would be logical that the expression has to evaluate to a valid field (existing or new in the msg - maybe also context).
So in your example, i guess nothing would be set.

Can you give an example of what the expression could be? How does it return something that identifies the field of the message to set, rather than the value of that field?

In the source field i can enter something like this:

$eval(payload[0].payload.cfg.p1,payload[1])

which returns a field in payload[1], defined by the string in .p1 (like "payload.data.val")

Hello,

I also need to same thing. Being able to dynamically create/set properties from a change node.

I could be a Jsonata expression in the target properties, or to be able to access properties in a Javascript way

SET
flow.mode[msg.topic].enabled
TO
Boolean true

As msg.topic is a a string for the target mode that would eventually means flow.mode.vip.enabled

Thank you