# How to process elements of an array serially in node-red?

**URL:** <https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997>\
**Category:** General\
**Created:** [4 August 2019 16:45 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997 "2019-08-04T16:45:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmith](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jsmith](https://discourse.nodered.org/u/jsmith)\
**Post date:** [4 August 2019 16:45 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/1 "2019-08-04T16:45:41Z")

</div>

> <https://stackoverflow.com/questions/57347704/how-to-process-elements-of-an-array-serially-in-node-red>

Here is the scenario -

1. In flow1 we run a sql query to retrieve some rows ordered by timestamp
2. Flow2 defines a sequence of API calls , so this flow executes asynchronously
3. For each result in flow1 , we need to invoke flow2 "synchronously" , i.e next element should be processed only when execution of flow2 has comepleted for previous element

With the split and join solution, the order can not be guaranteed.

What could be the simplest way to handle this scenario ?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [4 August 2019 17:06 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/2 "2019-08-04T17:06:14Z")

</div>

The simplest way of dealing with the “asking a question” scenario is to ask in one place at a time. Otherwise you could end up with contradicting solutions, or you get an answer in one place, but on the second site people still spend their time answering a question you already have an answer for.

---

<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:** [4 August 2019 17:14 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/3 "2019-08-04T17:14:20Z")

</div>

Has this question been asked elsewhere then?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 August 2019 17:24 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/4 "2019-08-04T17:24:24Z")

</div>

See the first post Colin.  
Stackoverflow & here.  
😄

---

<div class="post-metadata">

**Author:** ![jsmith](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jsmith](https://discourse.nodered.org/u/jsmith)\
**Post date:** [4 August 2019 17:24 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/5 "2019-08-04T17:24:58Z")

</div>

Sorry about posting at multiple places , just that I realized after posting on stackoverflow that this forum was probably more active and faster way to get the solution. Will ensure to update the first solution from either forum to other one.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 August 2019 18:18 UTC](https://discourse.nodered.org/t/how-to-process-elements-of-an-array-serially-in-node-red/13997/6 "2019-08-04T18:18:37Z")

</div>

Maybe something like this

[https://flows.nodered.org/flow/cea8afa28b7a93ebdc0f](https://flows.nodered.org/flow/cea8afa28b7a93ebdc0f)
