Loop

Iterates over a collection and runs children for each item.

When to use?

When you want to iterate over each item in an array and do something with it.

How to use:

  1. You can name the element in the Name field
  2. Make sure you've got an indexed array by the way of Http Client, Json Reader or Set Parameter element
  3. In the Items field enter the name of the array, as shown in this example: ${array_name}
  4. In the Data collection item name enter the name under which you'll be able to access individual array items, for example: item
  5. You can skip iterations of as many items as you wish, starting from the beginning of the array, by entering an offset number in the Offset field
  6. Entering a limit number in the Limit field limits the loop to the specified number of iterations
  7. You can place any number of other elements inside the Loop element
  8. To access array values, use this syntax: ${item.value}
  9. To access array indexes, use this syntax: ${item.index}
  10. If you want to output array indexes, counting from number one instead of zero, use this: ${item.natural}
  11. To identify the first, or the last iteration, use this syntax: ${item.first}, {item.last}

Example of usage in case of a two dimensional array:

We created a two-dimensional array in this format: players[index]["score"], and we want to output player scores.