For Loop ending after 1 iteration

Hi all.

Apologies if this is very basic question or problem, but I’ve recently started work with postman flows.

I’ve managed to call an API which returns a data block and within this there is an array of data items with 9 records in it. See below:
**


**
I then want to iterate through this array using the data contained to call another API. So, I’ve created a data block with the array in it and put a ‘For’ loop after this with a link to the next API, below. For some reason, it only ever calls the API with the first data iteration and just stops. Can anyone see what I may be doing wrong here? I’ve looked at tutorials and examples but I cant see a huge difference in approach. This is my first attempt at this so could well have done something obviously wrong to anyone other than me. I should probably add this is a loop within a loop which probably complicates matters.

Thanks in advance
Chris

Hi @chrisdoar

Flows variables can’t be reset (they are really constants to be set once and reused multiple times). Try updating your flow to use direct connections with select blocks instead of variables and let me know if it’s still getting stuck.

It’s also possible there’s something going on with the double for loop, can you provide a screenshot of the whole flow in one screenshot if possible?

Thank you very much @flows-daniel for the reply. Greatly appreciated. I presumed the variables would be updated upon each iteration of the data running through. Good to know they are actually more like constants.

Please find below a working flow with a single input into the first ‘Send Request’ after I’d moved the extra for loop and replaced the variables with direct connections.

I now want to replace the constant ‘accountNumber’ in the first send request with a list and a for loop like below: It is when I introduce this it stops after the first iteration. I think its related to the third screen shot below but as I’m so new to this, I’m not 100% sure
image

Sorry if this is a stupid question, but is there a way to merge outputs into one input? So, the two green circled values are fed into the next (red circled) ‘for’ loop. As I think this is the cause of the issues.

Thanks, Chris

Hi @flows-daniel. I think I’ve figured out how to merge the data together. This seems to create a primCard record to every data array from the other call. Making progress with this :slight_smile:

image

1 Like

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