Iterating environment variable names

i would like to run a test 3 times and each time to set a specifici parameter as an environment variable but labelled correctly .
For example if i would like to add a name to my book each time i run the request. The parameter name is “name” and the request is identicle each time. However i’d like to save the responses as environment variables clearly eg name1, name2, name3, how could i set that up in a collection runner?

Hello @hannahbroch ,
You can create a new environment variable to store the response value by concatenating the new environment variable with a counter for example so that it doesn’t happen to always look at the same variable. Concatenating with a value that will always be incremented it will always create a new variable for example like name1, name2, name3…


pm.environment.set("name"+1, "Test")

Where 1 can be replaced by a counter variable and as you are going to manipulate the response you must manipulate the code in the “Test” tab.

In case I got it wrong or if you need something else, I’m available to help :wink: