# Create a function with 2 outputs with condition

**URL:** <https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424>\
**Category:** General\
**Tags:** function-node\
**Created:** [14 August 2022 14:23 UTC](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424 "2022-08-14T14:23:14Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 August 2022 20:21 UTC](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424/22 "2022-08-15T20:21:34Z")

</div>

Ok colin,

So i edited my function node like this :

 ![function switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c2f90990c59a5d6363855c0eccd254f23dbc687.jpeg)

and i put all debug node in my entry and you can show this :

 ![debug](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c2e00bd9d79dc5ec49f3f481f2eb837241679916.jpeg)

**EDIT :** I just find a node (node-red-contrib match) and it's work, If is right go on top, if is fasle go on bottom.

But i've new problem now, i've a problem when i start my flow, my join node take directly one value so, i need to push, long to make an error and reset the join node, and push short and my dashboard button to make the rules. and my vidéo start. so i don't understand why.

---

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [15 August 2022 20:51 UTC](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424/24 "2022-08-15T20:51:11Z")

</div>

Ok guys,

So, i found the solution this is my new flow with the **match node** :

 ![good flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39c928a2d98ca8fd4ae0be2f7a701175e73e9a72.png)

I needed to change the join flow to this, i changed key/value to string :

 ![join node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/8/986a923d3a72532fc477c801b9a28da4d0479734.png)

And my match node :

 ![match node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39e636a58760521a4bca462935a8740b2e16f346.png)

So, all is work, just now, i've a problem with message sending, like my preview post, when i start my flow, the value long is directly send, so my join node wait only one other value and not 2, so how to remove the first value at start ?

---

<div class="post-metadata">

**Author:** ![azertym](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/azertym/32/52108_2.png) [@azertym](https://discourse.nodered.org/u/azertym)\
**Post date:** [16 August 2022 10:50 UTC](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424/25 "2022-08-16T10:50:26Z")

</div>

Hi everybody,

Sorry for the repost a ne message again but i found the solution !

I use the node séquence detector it is perfect for me. [node-red-contrib-sequence-detector (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-sequence-detector).

This is my flow :

 ![flow final](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/b/eb40d60bcdf8fb5f91a4d05e4f43224e47769623.png)  
Is not really clean but it's work.

and my node sequence detector very easy :

 ![sequence](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e71b1bad7251464eab5ee37c6d992a062369e9b.png)

So it's much easier to use this node that join node for me.

Thanks for all guys !

---

<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:** [30 August 2022 10:50 UTC](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424/26 "2022-08-30T10:50:50Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/create-a-function-with-2-outputs-with-condition/66424.md?page=1)
