An Iterate loop repeats the series of grouped activities once for every item in a list. The list is stored in a process variable and can be items of any datatype. The following is an example of an iterate loop.
In this example, the process variable $RegionTotals is used to determine the number of iterations to perform. One iteration is performed for every element contained in the repeating element.
The Iteration Element field on the Configuration tab allows you to supply a name for a process variable containing the current iteration element. This allows you to easily map the value of the current iteration element instead of using predicates on the process variable used for iteration. When you specify a value for this field, a process variable with the specified name appears in the Process Data tree in the Input tab. For example, in the Iterate group above, we specified
currentRegion as the name for the current element. This causes the following to appear in the process data tree:
Notice that both $RegionTotals and
$currentRegion contain the element
Region.
$currentRegion/Region is a copy of the
$RegionTotals/TotalsByRegion/Region[i] element, the current element being processed. If you use
$RegionTotals/TotalsByRegion/Region[i] in an input mapping, TIBCO ActiveMatrix BusinessWorks BPEL Extension traverses the
$RegionTotals/TotalsByRegion/Region element to retrieve the current element each time the loop iterates. By using the
$currentRegion/Region element instead, you save processing time in proportion to how many times the iteration loop repeats. The larger number of elements contained in the
$RegionTotals/TotalsByRegion/Region repeating element, the greater the performance improvement you will notice by using
$currentRegion/Region instead of
$RegionTotals/TotalsByRegion/Region[i].