# Postman flow loop indexing issue

**URL:** <https://community.postman.com/t/postman-flow-loop-indexing-issue/59156>\
**Category:** Help Hub\
**Tags:** iterations, postman-flows\
**Created:** [March 22, 2024, 9:01pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156 "2024-03-22T21:01:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 22, 2024, 9:01pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/1 "2024-03-22T21:01:31Z")

</div>

Hello community

I have a flow that stops executing even though my loop has not completed and I believe it has to do with indexing but I am not sure and do not know how to resolve it, if it is.

Here is my flow:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/8/e81f77ec7ee2274de3b01682d07bb401ef5be5fd.png)

log:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/a/ca90bb0dab25722fda481ebc2a5f8ebf75c839cd.png)

I think it stops because I have selected body.data.0.id when running a request through the loop

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/3/8303d5e07f1cc2f5e3cfb36848811ef1b1284a88.png)

Otherwise, maybe something else is wrong with my loop that I am unaware of.

Thanks

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [March 22, 2024, 9:43pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/2 "2024-03-22T21:43:06Z")

</div>

Hi @legiuffre

Looks like the evaluate block on top might be causing it. Try combining that evaluate item with the output of the Send Request block in a record block and sending both through the “data” port of the If block so the values only go through when the condition is true.

For example:

 ![Screenshot 2024-03-22 at 2.42.11 PM](https://us1.discourse-cdn.com/getpostman/original/3X/0/2/020415256ccaa1811fa3a8173fc41e1a6406820f.png)

---

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 25, 2024, 12:26pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/3 "2024-03-25T12:26:33Z")

</div>

While that was probably an issue, I also identified that there are duplicate records in my result set which appear to be messing with the loop. Do you have any advice on error handling this way?

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [March 25, 2024, 6:30pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/4 "2024-03-25T18:30:11Z")

</div>

Try using the [$distinct](https://learning.postman.com/docs/postman-flows/flows-query-language/function-reference/#distinct) FQL function if the items are exactly the same in every way.

 ![Screenshot 2024-03-25 at 11.28.38 AM](https://us1.discourse-cdn.com/getpostman/original/3X/c/3/c3663f8f64bb3324cf671fe457d56b2b4370e3b1.png)

---

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 27, 2024, 4:25pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/5 "2024-03-27T16:25:57Z")

</div>

Hello again

I modified the result set to not include duplicates and still am stuck in a loop:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/7/4/741906c76d4766602decbe127f5f1ec249088c46.png)

---

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 27, 2024, 5:14pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/6 "2024-03-27T17:14:15Z")

</div>

Disregard, I am not sure what happened but it is working now as expected.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/4/04d9ea7e17696480c82eca2a7492ee5642addbaa.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [March 30, 2024, 5:14pm UTC](https://community.postman.com/t/postman-flow-loop-indexing-issue/59156/7 "2024-03-30T17:14:15Z")

</div>

Closed on March 30, 2024, 5:14pm UTC

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