For Each Parallel
This block is a ForEach loop that traverses multiple items from a collection in parallel. It can run several threads simultaneously but doesn’t do anything by itself.
You should put other blocks above the End Parallel For line, which is the ending of the For Each Parallel block, in order to create a pattern.
For Each Parallel makes it easier to perform the same actions on all elements from a list.
The block has a List field that must contain an array. Arrays are initialized with [*], where * is the content that you want to list. Elements are separated by a comma.
Iterations start with the first element from a list, (index=0), and continue until the last element of the list, (index=(n-1)), where n is the total number of elements.
The Concurrency field is the number of threads that will be open simultanously for the execution of blocks within the For Each Parallel structure.
If we have Concurrency of 2, we could execute the iterations in twos, meaning 2 iterations in parallel threads, 2 more, and so forth, until the end of the iterations.
Keep in mind that the block exhibits different behaviors depending on the scope set in the Start block.
Drag For Each Parallel and drop it inside a workflow where a green field appears. Doing so makes it a part of the workflow.
For Each Parallel works well with Assign.
Enter information in the List field.
Set Assign according to the actions you want executed.
Run the workflow to see the effect applied.
The resulting structure will execute parallel threads for multiple items listed in the array. The number of threads is the Concurrency number you have provided.
Refer to the current element of the iteration by typing $Name.item, where “Name” is the name of the For Each Parallel block.
To disable a For Each Parallel block without deleting it, use the slider on the left of its name.