# Split node? Sorting

**URL:** <https://discourse.nodered.org/t/split-node-sorting/33657>\
**Category:** General\
**Created:** [2 October 2020 07:36 UTC](https://discourse.nodered.org/t/split-node-sorting/33657 "2020-10-02T07:36:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![niclas.w82](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/niclas.w82/32/31813_2.png) [@niclas.w82](https://discourse.nodered.org/u/niclas.w82)\
**Post date:** [2 October 2020 07:36 UTC](https://discourse.nodered.org/t/split-node-sorting/33657/1 "2020-10-02T07:36:59Z")

</div>

Hi.

I need to sort payload to specific output. I have tried to use a switch node to do this.  
I want to get the whole payload but only if the Array meets the conditions.  
If the Array exernal id is ID:19\_20181001.... the whole payload will come out at the first output in the switchnode. And if the Array external id is ID:20\_20201588... the whole payload will come in output 2

Hope you understand what i trying to explain.

Best Regards Niclas

 ![node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3a487518879d18d0f564f3e88303d79a1b9bfdb1.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [2 October 2020 08:09 UTC](https://discourse.nodered.org/t/split-node-sorting/33657/2 "2020-10-02T08:09:50Z")

</div>

`msg.payload.external_id[0]` is a string "ID:19\_20181001\_142048"

so either convert it to an object or

compare the whole string including the "ID:" portion

`msg.payload.external_id[0] == "ID:19_20181001_142048"`

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 October 2020 08:11 UTC](https://discourse.nodered.org/t/split-node-sorting/33657/3 "2020-10-02T08:11:00Z")

</div>

What have you tried with the Switch node?

It looks like the property you want to test is `msg.payload.external_id[0]` - so you'd put that in the property box at the top of the node.

You can then add rules for each of the values you want it to test.

---

<div class="post-metadata">

**Author:** ![niclas.w82](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/niclas.w82/32/31813_2.png) [@niclas.w82](https://discourse.nodered.org/u/niclas.w82)\
**Post date:** [2 October 2020 11:42 UTC](https://discourse.nodered.org/t/split-node-sorting/33657/4 "2020-10-02T11:42:54Z")

</div>

Hi Thank you!!

Seems to work to use property.

I will contniue try if this will work.

Bets Regards Niclas

---

<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:** [1 December 2020 11:42 UTC](https://discourse.nodered.org/t/split-node-sorting/33657/5 "2020-12-01T11:42:55Z")

</div>

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