Split-Node an using only couple payloads

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.


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

Welcome to the forum @Jrlohni

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.

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!

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.

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:

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.

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

Hi!

Now I understand! Thank you for your help!

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