"change node" Variables in key

#1

Hello
It is possible to use templates in keys?
I need to dynamically add/remove values and I need to parse these values from incoming msg.payload.
I know how to do this with "function node" but i want to do this in "change node"

img_1

I need this:

img_2

0 Likes

#2

Hi @Little - no, it isn't possible to do that.

If you were getting a value from context, then you could use a JSONata expression, as I described in this topic - How to use msg.payload as an index in a change node?

But you want to set a value in context... there's no convenient way of doing that in a Change node today. You'd have to use a Function node:

flow.set("store.mode_"+msg.payload.index,msg.enabled);
return msg;
0 Likes

#3

Thanks. I will continue to use "function node"

0 Likes