Sequential Execution of an Array

Hello Everyone,
I am new to node-red and i am trying to loop through an array and trying to do something for each item in an array in a sequential manner. Only after all the nodes between the split and the join are completed for 1 item, the next item should be started. However its not likely the case.

Its always the below behavior

Something 1
Something 1
Something 1
Something 2
Something 2
Something 2
Something 3

Expected:
Something 1
Something 2
Something 1
Something 2
Something 1
Something 2
Something 3

Is that even possible. I know i can create a function node with a for each and do it. But i am looking for a more visual approach.

Thanks for the help !

Hi @tonytroy

Have a look at https://flows.nodered.org/node/node-red-contrib-queue-gate - you can add the gate node after the split node and use that to control the flow of messages.

1 Like

The example Retain Until Processed on the node's page has an example flow doing basically what you want. If you put the node before the Split and then use the output of the Join to release the next message it should work.

1 Like

I used the array-loop feature of node-red-contrib-loop-processing and it works as expected. Attaching the screenshot

I did experiment q-gate. It needs to be triggerd by having "peak" present in msg.payload. I have my array in the payload. I was having trouble triggering the q-gate automatically without a manual trigger.

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