Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 5 Scopes, Iteration, and Conditional Processing Using Groups : Iterate Loop

Iterate Loop
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.
The orchestration process performs the following operations:
1.
2.
3.
d.
e.
The following is the configuration for this example:
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 Variable List field is an XPath expression. You can use a simple expression containing a complete list as in the example above, or your expression can be more complex and only process certain items in the list. For example, if you wish to skip over the first 10 regions, the expression in the Variable List field would be the following:
See TIBCO ActiveMatrix BusinessWorks Process Design Guide for more information on creating XPath expressions.
Iteration 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].

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved