Node-RED 1.0.5: Functions with multiple outputs

I'm trying to use the Multiple Outputs example from the Writing Functions user guide.

With the suggested example, the function keeps one single output.

var newMsg = { payload: msg.payload.toString().length };
return [msg, newMsg];

Note: I've added toString() to convert timestamp into a string.

A functional workaround uses node.send().

var newMsg = { payload: msg.payload.toString().length };
return msg;


Does releases 1.0 and onwards change the way multiple outputs are handled by a function?

Thank you!

Initial flow

[{"id":"e32e22fd.cfc598","type":"function","z":"56997b57.3c88ac","name":"","func":"var newMsg = { payload: msg.payload.toString().length };\n\n//node.send(newMsg);\n//return msg;\n\nreturn [msg, newMsg];","outputs":1,"noerr":0,"x":270,"y":100,"wires":[["25e587dd.535e38"]]},{"id":"f207fa9f.569d38","type":"inject","z":"56997b57.3c88ac","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":100,"wires":[["e32e22fd.cfc598"]]},{"id":"25e587dd.535e38","type":"debug","z":"56997b57.3c88ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":480,"y":80,"wires":[]}]

have a look at Outputs, if function node is open (edit) at the bottom on the left
change the to 2 or more


Thank you! So obvious I didn't see it.

Maybe it would be worth mentioning it on the Multiple Outputs example from the Writing Functions user guide.

The function edit dialog allows the number of outputs to be changed. If there is more than one output, an array of messages can be returned by the function to send to the outputs.

It is in there

1 Like

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