Go over each element in a collection and do something with it.
If you have an array of items, or any other collection that can be traversed, and you want to perform an operation with each item, use this element.
Http Client
, a Json Reader
, or set manually with Set Parameter
.${array_name}
item
.
The item object has several built in properties:
value
property: ${item.value}
${item.index}
${item.natural}
to get the item's index as if it were counted by a human, that is to say, starting from 1.${item.first}
and {item.last}
Suppose you have an array of players, imaginatively called players
, and each player has a score
. Here is an example showing how you could output each player's score:
${players}
player
. Note the lack of expression syntax wrapper! Do not write ${player}
by mistake!Text Response
element inside the Loop
elementText Response
element's Text field, write Player${player.natural}
's score is${player.value.score}