For loop missing first entry in List

Hi all,

Loving Postman Flows but have found a weird issue that I hope is just me and not something far more fundamental.

I’m making a webservice call which is returning a JSON payload inside which is an array. This maps to a List in a For loop.

I like to see what’s going on so I have Output elements everywhere followed by a Delay element. I find this really useful.

What I’m noticing is that the first entry in the list is always skipped. It always jumps to the second entry.

I tried creating a List manually and pushing that into a For loop and the same thing occurs.

Has anyone else experienced this?

Many thanks

Mark

So I had a thought to Log it out to the console too.

Interestingly, the Log shows each entry, but the Output always starts with the second entry

So this issue, if there is one, appears to be with the Output. It always seems to be one further along. I put a Log after the Output and that displayed to the console a different value to the Output. Really strange behaviour … be interested to know if anyone else is experiencing this

Hi @grendal2023

Welcome to the forums!

Do you have a screenshot of what you’re trying? I want to make sure I understand the problem completely.

Hi @flows-daniel ,

Thanks for responding.

Here is a screenshot of a noddy test. In it you will see that I’m making a call to postcodes.io webservice to get the nearest postcodes to a given postcode. This returns a list (body.result).

I’ve output the entire payload so I can see each entry.
I then push this through a For and output the entry. I also push that entry to the Log.
I added a delay so I could stop it immediately after the first item was displayed.

As you can hopefully see, the Log has shown two entries ([0] and [1]) whereas the Output is only showing [1] (or has shown both, the speed meaning it has now moved to [1].

My expectation would be that the first entry would be seen

Hope this helps

Mark

Hi @grendal2023

That’s very helpful thank you. If you want to view the results one at a time you can put the delay block between the for loop and the output block.

What’s happening is the first result hits the output block (instantaneously) and then is sent to the delay block. The next item in the list then hits the output block (which is what you see) and waits until the delay finishes with the first element to be able to continue.

Many thanks for the clarification on that. I thought the For loop wouldn’t iterate until the delay had finished.

Again, many thanks for the swift response

1 Like

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