Iterator actions work by executing their child actions for each item that the iterator finds.

For example, a list iterator might have 3 items: "A, B, and C", and a variable to set : "ListItem".  

When the iterator runs, it will run its child actions 3 times - the first time, the variable "ListItem" will have value "A". The second time, it will have value "B" and the last time, value "C".

(The list iterator in the above screenshot has been paused during the fifth of six iterations.)

Iterator Actions Summary

Action Name Summary File IteratorIterate through multiple files or a While Loop action which, while not technically an iterator, can execute its children more than once.

Iterator Script Events

Iterators have the following script events:

Before Action & After Action (common to all actions)

These events fire before and after each iteration (including the last iteration.) It is not really recommended that you use these events for Iterator actions.

OnAfterEachIteration

This event fires after all the child actions have run for each iteration. In the example above, OnAfterEachIteration would execute following each invocation of the "Do something else" action group.

This is equivalent to having a Run Script Action as the last child of the iterator.

The best way to run some script before each iteration begins is to add a Run Script Action as the first child of the iterator.

OnFirstRun

This script event fires the first time the action is run, before the variable has been set to its first value. If the iterator relies on some variables to generate the list of iterated values, you can set them from the OnFirstRun event.

This is equivalent to having a Run Script action placed immediately before the iterator action.

  • No labels