For Each Activity
A For Each activity repeats the execution of a section of the workflow several times for a number of target instances in a collection.
Execution of a For Each branch activity works as follows:
- At the beginning of the For Each activity, a For Each variable local to that branch is set to the first instance in the collection.
- Execution continues to the end of the For Each activity. Activities refer to the For Each variable to perform operations with or on the current instance.
- At the end of the For Each activity:
- If all instances in the collection are exhausted, execution continues after the For Each activity.
- Otherwise, execution returns to the beginning of the For Each activity and the local For Each variable is set to the next item in the collection.
Note: The order in which instances are chosen from the collection cannot be configured.
General Settings
Inputs | Description | |
---|---|---|
Collection | Displays IEnumerable. This is defined by the workflow and can be bound to parameters, local variables, properties of other activities including outputs of previously executed activities, and external variables having compatible types. Note: When binding to a Data Table returned by a data item read, if the For Each is bound to the rows collection of the DataTable, there is an output property for each column in the table. |
Outputs | Description | |
---|---|---|
Current Item | Displays as object type. This is defined by the contained activities. |
Example
For Each can repeat all subprocesses by selecting the workflow's subprocesses property as the Items Collection for iteration.