kiki
1
Hi,
I'm using a function node and want to name the "store path" of the object variable.
At the moment my Output looks like
"element_i"
My actual code looks like this:

But I want to have
element_1
...
element_8
I hope anybody can help me to solve my problem.
Thank you!
The sure fire way is to make a variable for the string value you want to use:
var elemName = "element_" + i;
Then use bracket notation to assign the payload to that key:
msg.payload[elemName] = {...
Bracket notation will interpret a variable into the actual key name and give you what you want.
1 Like
kiki
3
yessss! That's working 
Thank you for your help @madhouse !
system
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.