Multiple output of function node not working as shown

As brief as possible:

[{"id":"3cc824ef.442dd4","type":"inject","z":"710ca09a.8302a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":500,"y":990,"wires":[["44a42f6c.0772c8"]]},{"id":"44a42f6c.0772c8","type":"function","z":"710ca09a.8302a8","name":"Reboot?","func":"var msg1 = {\n    payload:\"CLS\",topic:\"pifacelcd/ctl\"\n}\n\nnode.warn(msg1);\n\nvar msg2 = {\n    payload:\"Do you want to@0,0\"\n}\nvar msg3 = {\n    payload:\"REBOOT?@0,1\"\n}\nnode.send(null,msg1);\n\nnode.send(msg2,null);\n\nnode.send(msg3,null);\nflow.set(\"command\",\"REBOOTING\");\n\n//return;","outputs":2,"noerr":0,"x":783.3333129882812,"y":991.111083984375,"wires":[["8c9a970c.5773f","911ba349.33a4c8"],["70150b6f.86490c","3c156b80.045b5c"]]}]

I don't understand why I am not getting msg1 out of the first output.
I see msg2 and msg3 come out the second one.

The code complies with the requirements I see here:
multiple outputs

Where it gives an example:
(though not exactly what I have.)

if (msg.topic === "banana") {
   return [ null, msg ];
} else {
   return [ msg, null ];
}

But demonstrates what I am doing.

Here is another (better?) example:

[{"id":"83b635df.a823d8","type":"function","z":"710ca09a.8302a8","name":"","func":"msg1 = {\n    payload:\"Output 1\"\n}\nmsg2 = {\n    payload:\"Output 2\"\n}\nnode.send(null,msg2)\n\nnode.send(msg1,null)\n\n","outputs":2,"noerr":0,"x":700,"y":1520,"wires":[["4327d036.334e48"],["d9a075d2.a3d0a8"]]},{"id":"e3f5cf41.8d96f","type":"inject","z":"710ca09a.8302a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":1520,"wires":[["83b635df.a823d8"]]},{"id":"4327d036.334e48","type":"debug","z":"710ca09a.8302a8","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":1480,"wires":[]},{"id":"d9a075d2.a3d0a8","type":"debug","z":"710ca09a.8302a8","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":1560,"wires":[]}]

Ok, I'm an idiot.

The line should be:
node.send([null,msg2])

That works.

Sorry.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.