How to compare consecutive payloads in node-red?

Hello everyone ,
I am relatively new to node-red , I wanted to know How to compare consecutive payloads in node-red , I am actually getting stream of payloads from same source and wanted to compute values , for this processing i need to compare the payloads . If anyone knows about it please help!!
Regards
Aalhad

You need to save the payload in the node context and then you can pick it up the next time round.
See the section on Storing Data in
https://nodered.org/docs/writing-functions

2 Likes

You could use a join node and tell it to wait for 2 consecutive values and put them in an array. You can then use array arithmetic on the values.
Screenshot%20at%202018-08-28%2014-20-20

1 Like

I believe that the collector node might do this for you. I use it to keep repeated peeks at a mail stream from repeating the same messages.

1 Like

Thanks colin ,ghayne and ray i am working on the methods you guyz suggested , will come back to you guyz on the same.

Regards,
Aalhad