# What is wrong with this function code?

**URL:** <https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672>\
**Category:** General\
**Created:** [20 February 2022 03:40 UTC](https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672 "2022-02-20T03:40:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [20 February 2022 03:40 UTC](https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672/1 "2022-02-20T03:40:28Z")

</div>

From everything I've been able to find this code in a function in a subflow should produce 2 output connectors, the 2nd for the subflow status to connect to. But there is only 1 connector.

```auto
if (isNaN(msg.payload)) {
    node.warn("Input is NaN");
    msg.payload = "";
} else {
    msg.payload = ((msg.payload * 9 / 5.0) + 32).toFixed(1)
}
let statusMsg = { fill: "green", shape: "dot", text: "`${msg.payload.toString}°F`" };
var newMsg = { payload: statusMsg };
return [msg, newMsg];

```

Yes, I know that the construction of statusMsg is probably wrong but first things first.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [20 February 2022 03:43 UTC](https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672/2 "2022-02-20T03:43:51Z")

</div>

You have to increase the number of outputs in the function node.

---

<div class="post-metadata">

**Author:** ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)\
**Post date:** [20 February 2022 03:46 UTC](https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672/3 "2022-02-20T03:46:22Z")

</div>

Thank you!!! Didn't even think to look 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:** [21 April 2022 03:47 UTC](https://discourse.nodered.org/t/what-is-wrong-with-this-function-code/58672/4 "2022-04-21T03:47:07Z")

</div>

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