*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
loop.
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 loopIn 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: XML variable: 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 button.
Use the Select an Element from The XML Variable field to select
an element from your XML variable. Click the button
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.
Collection variable: 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 button.
Use
the Maximum Loop Size option to specify the maximum number of iterations
for the loop. Click Next.
Enter a name for the new empty subprocess that handles each
element of the loop. Click Next.
Review the summary of the setup you completed. Click Finish.
Understanding the loopLoops 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:
iteration_wizard_datasize:
Reads the number of elements in the XML variable or represents the
size of the collection variable.
iteration_wizard_data: Stores the current value of
the data source that the loop executes each time it is run.
iteration_wizard_counter: Stores the current iteration
count of the loop. Starting with zero, the value is incremented
each time the loop executes successfully.
iteration_wizard_valueList: 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:
The exit infinite loop route
is followed when the iteration_wizard_counter exceeds the maximum
size of the loop.
The has next element route is followed when the validation
for exit infinite loop route fails. Indicates that the loop
still has elements in its XML variable or collection left to be
executed.
|
|
|