# Postman Flow - Display Current Index in For Loop

**URL:** <https://community.postman.com/t/postman-flow-display-current-index-in-for-loop/62166>\
**Category:** Help Hub\
**Tags:** variables, loops, postman-flows\
**Created:** [June 13, 2024, 6:47am UTC](https://community.postman.com/t/postman-flow-display-current-index-in-for-loop/62166 "2024-06-13T06:47:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelminn](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@michaelminn](https://community.postman.com/u/michaelminn)\
**Post date:** [June 13, 2024, 6:47am UTC](https://community.postman.com/t/postman-flow-display-current-index-in-for-loop/62166/1 "2024-06-13T06:47:49Z")

</div>

I am trying to create an index value for a for loop, I am setting up a large json array and it would be useful to see where it currently is in the for loop.

I have found this article thats only 3 months old but cannot see any pin icon on my variables: [Pin variables in Postman Flows | Postman Learning Center](https://learning.postman.com/docs/postman-flows/concepts/pinning-variables/#pinned-variable-behavior-in-loops)

Here is a dummy flow I recreated without my business logic, in short I don’t understand how to assign the output of the evaluate in the for loop back to index variable. I tried adding the evaluate so the ‘Create Variable’ is outside the for loop to try and ensure its a defined outside the loop and as mentioned the documented pin feature doesn’t seem to be there.

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/5/1/5115e65be61cf1b0508bfee934319679f8f29fa3.png)

---

<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:** [June 13, 2024, 3:55pm UTC](https://community.postman.com/t/postman-flow-display-current-index-in-for-loop/62166/2 "2024-06-13T15:55:54Z")

</div>

Hi @michaelminn

Welcome to the forums!

Pinning will only show up when the variable is filling a value of another block (see below):

 ![Screenshot 2024-06-13 at 8.47.13 AM](https://us1.discourse-cdn.com/getpostman/original/3X/e/a/eaf77f73d6093986cc8abf33d072dc45e79ad80f.png)

The simplest way to get the index is using TypeScript `indexOf` for the array demonstrated below (To access TypeScript, click the drop down that says FQL in the top right of the Evaluate Block):

 ![Screenshot 2024-06-13 at 8.45.51 AM](https://us1.discourse-cdn.com/getpostman/original/3X/e/2/e2877bb6354ba9a2fb4d6d03851bb35b50706782.png)

What I provided will just return the index from the Evaluate block. So you will still need to add in your business logic for whatever you’re doing 🙂

---

<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:** [July 13, 2024, 3:56pm UTC](https://community.postman.com/t/postman-flow-display-current-index-in-for-loop/62166/3 "2024-07-13T15:56:12Z")

</div>

Closed on July 13, 2024, 3:56pm UTC

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