Working with an Array

I am creating an array from 4 different MQTT payloads that monitor a percentage. I then do a difference calculation and post the result to a dashboard. It works, but only if the broker sends message 1-4 during the measurement cycle.

However, debug shows there are times when not all messages are broadcasted during a measurement cycle and the array will randomly see duplicate inputs such as [2,3,2,4] instead of [1,2,3,4].

How would I load an array only when messages 1-4 are received? Any duplicates would be updated while waiting for the final message to arrive

Join as a key/value object, then you can be sure of no duplicates, you can easily turn an object to an array if you really require an array.

Without seeing an export of your flow I can not give an example.

I'll take a look at the join node tonight and play around with it. I'll post the flow next time.

Thanks for the advise.

Corey

See this article in the cookbook for an example of how to join messages into one object using key/value mode.

Colin and E1SID,
The join node worked like a charm and my flow now works as expected

Thanks for the help,

Corey.

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