Looping in Processes
*New for 10*
In earlier versions of Workbench, users had to manually add circular
routes with conditions to implement looping. In addition, counters
were created explicitly to track execution and termination of the
The Iteration Wizard feature in Workbench allows you to automatically
generate loops based on subject, size, and data source.
Adding a loop is a two-step process:
Identify a data source
: The data source for the
loop can be an XML or a collection variable (List or Map).
Identify the subject
: The subject for the loop is
an empty subprocess, which can be defined with a service operation
at a later point.
Adding a loop
In the process designer, drag the Iteration
Wizard onto a swimlane in your process diagram.
On the Iteration Wizard, identify the data source the loop
can iterate on. Use one of the following variable types:
: Choose the XML Variable option and select
your pre-defined XML variable from the drop-down list. You can also
choose to add an XML variable by clicking the
Use the Select an Element from The XML Variable field to select
an element from your XML variable. Click the
to open XPath builder and build an XPath expression as required,
which is substituted for the element. The loop iterates over all repetitive
instances of this element.
: Choose the Collection Variable
(List or Map) option and select your pre-defined List or Map variable
from the drop-down list. You can also choose to add a new variable
by clicking the
the Maximum Loop Size option to specify the maximum number of iterations
for the loop. Click
Enter a name for the new empty subprocess that handles each
element of the loop. Click
Review the summary of the setup you completed. Click
Understanding the loop
Loops in Workbench consist of the following contained in
a collapsible group:
An empty subprocess that is designed to handle each
element of the loop. Define the subprocess activity with a desired
service operation for the loop to execute iteratively.
A set of three auto-generated variables:
Reads the number of elements in the XML variable or represents the
size of the collection variable.
: Stores the current value of
the data source that the loop executes each time it is run.
: Stores the current iteration
count of the loop. Starting with zero, the value is incremented
each time the loop executes successfully.
: Generated only when the
data source of the loop is a Map variable. This List variable stores
all values of the Map.
Two decision points evaluate further execution of the loop
using two distinct routes:
exit infinite loop
is followed when the iteration_wizard_counter exceeds the maximum
size of the loop.
has next element
route is followed when the validation
exit infinite loop
route fails. Indicates that the loop
still has elements in its XML variable or collection left to be