# Split-Node an using only couple payloads

**URL:** <https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003>\
**Category:** General\
**Tags:** split\
**Created:** [17 March 2022 18:59 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003 "2022-03-17T18:59:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jrlohni](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@Jrlohni](https://discourse.nodered.org/u/Jrlohni)\
**Post date:** [17 March 2022 18:59 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/1 "2022-03-17T18:59:39Z")

</div>

Hi!

I try using the split-node for cut some lines of a payload from a file and use them for a notification on my mobile.  
My problem is to join them after splitting to get only one notification with all informations. For the notifications I use Pushover - that's work well!

You see the content of the file in the debugging window. The string have to be cuttet at the "return" symbols. After that I will only use the "Date/Time", "Status number", "Status text", "P\_ACT", "V\_WIN" and "NGEN1".  
You see also in the debugging window at "node 4" the same string of the payload without spaces. I have solve it with the function node.

 ![Bildschirmfoto 2022-03-17 um 19.33.12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b839fdff7afad562b4f7b1b0743fdd4e74c46dd.png)  
 ![Bildschirmfoto 2022-03-17 um 19.33.30](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a7ea78cc55eeca4c7d8bc946cbda7ee4b497707a.jpeg)

Does anybody have an idea?

I have also another question to the email node. Is it possible to get a message if the Node runs into errors, like no connection or some similar?

Best regards  
Johannes

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [17 March 2022 20:27 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/3 "2022-03-17T20:27:24Z")

</div>

Welcome to the forum @Jrlohni

> [@Jrlohni](#):
>
> I have also another question to the email node

It is generally best to just ask one question at a time in each thread. Otherwise it will just get confusing. However, if you use a Catch node linked to the email node it should help you. I suggest starting a new thread if you want further help with that one though.

As for the extraction of data from the string, there are many possible solutions, but personally I would do it all in a function node. First split the string into an array. Is the string completely fixed format? So the data you want is always in the same lines? If so then you can write code to extract the data from the specific items in the array.

---

<div class="post-metadata">

**Author:** ![Jrlohni](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@Jrlohni](https://discourse.nodered.org/u/Jrlohni)\
**Post date:** [18 March 2022 19:21 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/4 "2022-03-18T19:21:20Z")

</div>

Hi!

Thank you for the reply. You are right! I think the email "problem" is solved. I have to test it a longer time.

I also solved the problem with the extraction of data with a function node. Anybody told me that i better not use function nodes so i had hoped that there is another node to solve the problem. Also I'm really not good at programming.  
So I got a new problem:

The string includes the part with: "Status number : XXXX". Now I have to filter for the numbers. I know that it is possible to solve it with the "switch-node", but there I found only filtered by "included". But I have to filter by "not included".

I have about 1000 status numbers but only 10 without a message by pushover. So it's easier for me to filter by "not included". I try to programm a function node - without success. Have anybody a script for me?

Greetings!

---

<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:** [18 March 2022 20:02 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/5 "2022-03-18T20:02:37Z")

</div>

> [@Jrlohni](#):
>
> I know that it is possible to solve it with the "switch-node", but there I found only filtered by "included". But I have to filter by "not included".

You can have two outputs on the switch node. First included and second otherwise. Otherwise will output all that not included.

If you wish people to write example scripts it best to provide data of input and how you wish the output to be, in a format that people can copy and paste.

---

<div class="post-metadata">

**Author:** ![Jrlohni](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@Jrlohni](https://discourse.nodered.org/u/Jrlohni)\
**Post date:** [22 March 2022 14:18 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/6 "2022-03-22T14:18:02Z")

</div>

Hi!

Yes I know that I can have two or more outputs on the switch node. My problem is that I have to set around 1000 outputs with different "switches" if I only search for "included". For this reason I wish to have the chance to set "not included". If I can search for "not included" I only have around 10 different outputs to set.

For example:  
Status number 1 - Notice  
Status number 2 - Notice  
Status number 3 - no notice  
Status number 4 - Notice  
Status number 5 - Notice

I would get a message if "Status number 3" is not included in the string. But in my opinion I only can search for included parts in a string.

My code:

```auto
if ($contains(msg.payload, "Status number : 65535")) {
    return 0;
}
else {
    return msg;
}

```

I would get no message if "Status number : 65535" is included in the string.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 March 2022 15:35 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/7 "2022-03-22T15:35:14Z")

</div>

Test status 3 and send to output 1  
Then select Otherwise and all else will go to output 2

---

<div class="post-metadata">

**Author:** ![Jrlohni](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@Jrlohni](https://discourse.nodered.org/u/Jrlohni)\
**Post date:** [26 March 2022 11:18 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/8 "2022-03-26T11:18:02Z")

</div>

Hi!

Now I understand! Thank you for your help!

---

<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:** [25 May 2022 11:18 UTC](https://discourse.nodered.org/t/split-node-an-using-only-couple-payloads/60003/9 "2022-05-25T11:18:13Z")

</div>

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