Postman Flow - Display Current Index in For Loop

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

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.

Hi @michaelminn

Welcome to the forums!

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

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):

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 :slight_smile:

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