Iterate Loop
An Iterate loop repeats the series of grouped activities once for every item in an existing sequence or list. The list can be items of any datatype. The following is an example of an iterate loop.
The process performs the following operations:
Procedure
-
A JDBC Query activity is used to query a database and populate a list of customer records. The customer records are then passed to a group containing one activity, WriteCustomerList.
-
The WriteCustomerList activity writes the name and address of each customer to a file, appending to the file as each record is written.
-
The group iterates once for every customer record returned by the QueryCustomer activity, and transitions to the ReadCustomerList activity once the last record is processed.
-
The process then reads the file that was written so that its data is available to the process, then transitions to a Send Mail activity to send the contents of the customer list by way of email.
The following is the configuration for this example:
In this example, the repeating element $QueryCustomer/Customer/Record is used to determine the number of iterations to perform. One iteration is performed for every element contained in the repeating element.
$QueryCustomer/Customer/Record[position() > 10]
For more information on creating XPath expressions, see XPath.