Hi,
I am having an issue to saving an array to a flow variable:
var l = flow.get("l") || []
l.push(msg.payload)
flow.set("l", l)
return l;
From my understanding of the documentation and the forum. this should get the array from the flow and then append the array, however, it always warps each object in additional array. As seen here:
I want this as ['value', 'value']
What am I doing wrong?
[{"id":"ac8ddef2a4f9cad8","type":"inject","z":"a8c551010c2bc0bc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"value","payloadType":"str","x":210,"y":660,"wires":[["156ea39e637c0279"]]},{"id":"156ea39e637c0279","type":"function","z":"a8c551010c2bc0bc","name":"function 2","func":"var l = flow.get(\"l\") || []\nl.push(msg.payload)\nflow.set(\"l\", l)\nreturn l;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":660,"wires":[["03ed314908d9848a"]]},{"id":"03ed314908d9848a","type":"debug","z":"a8c551010c2bc0bc","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":660,"wires":[]}]