# Node-RED 1.0.5: Functions with multiple outputs

**URL:** <https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196>\
**Category:** General\
**Created:** [20 April 2020 14:13 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196 "2020-04-20T14:13:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rei\_vilo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rei_vilo/32/162_2.png) [@rei\_vilo](https://discourse.nodered.org/u/rei_vilo)\
**Post date:** [20 April 2020 14:13 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196/1 "2020-04-20T14:13:18Z")

</div>

I'm trying to use the [Multiple Outputs](https://nodered.org/docs/user-guide/writing-functions#multiple-outputs) example from the [Writing Functions](https://nodered.org/docs/user-guide/writing-functions) user guide.

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

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

```

 ![Capture 2020-04-20 à 16.00.45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/34f7e9d27e5d83c023a8a22cbae722767282b7aa.png)

_Note: I've added `toString()` to convert `timestamp` into a string._

A functional workaround uses `node.send()`.

```auto
var newMsg = { payload: msg.payload.toString().length };
node.send(newMsg);
return msg;

```

 ![Capture 2020-04-20 à 16.01.20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/7/17f025691708aff7db804bad044afd3cc2acd52e.png)

## Question

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

Thank you!

## Initial flow

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

**Author:** ![homeplayer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/homeplayer/32/12388_2.png) [@homeplayer](https://discourse.nodered.org/u/homeplayer)\
**Post date:** [20 April 2020 14:17 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196/2 "2020-04-20T14:17:42Z")

</div>

have a look at Outputs, if function node is open (edit) at the bottom on the left  
 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/38eef695c4ebf941ca044be8b1e4daccefcdab58.jpeg)  
change the to 2 or more

---

<div class="post-metadata">

**Author:** ![rei\_vilo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rei_vilo/32/162_2.png) [@rei\_vilo](https://discourse.nodered.org/u/rei_vilo)\
**Post date:** [20 April 2020 14:29 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196/3 "2020-04-20T14:29:11Z")

</div>

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

Maybe it would be worth mentioning it on the [Multiple Outputs](https://nodered.org/docs/user-guide/writing-functions#multiple-outputs) example from the [Writing Functions](https://nodered.org/docs/user-guide/writing-functions) user guide.

---

<div class="post-metadata">

**Author:** ![homeplayer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/homeplayer/32/12388_2.png) [@homeplayer](https://discourse.nodered.org/u/homeplayer)\
**Post date:** [20 April 2020 14:37 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196/4 "2020-04-20T14:37:40Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 June 2020 14:37 UTC](https://discourse.nodered.org/t/node-red-1-0-5-functions-with-multiple-outputs/25196/5 "2020-06-19T14:37:42Z")

</div>

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