For-Each Loops are used to iterate over a collection of items such as a list of files contained in a File List or a collection of data in a RowSet. The For Each Loop will perform the same set of Tasks on each item in the collection.
Example Uses:
Loop through a set of rows (records) retrieved from a database table (which is contained in a RowSet variable). For each row in the loop, call a program to process the data.
Loop through a set of files that were retrieved from a FTP server, which would be contained in a File List variable. For each file in the loop, decrypt the file and send it to another internal server.
Loop through a list of file attachments that were retrieved from an email server. For each file attachment in the loop, encrypt the file and forward to another email address.
When looping through a RowSet (a collection of Rows), a row is exported to the Current Item Variable specified on the For Each Loop. To access the value of a specific column in the row, use the following syntax in a task under the For Each Loop:
${rowVar[columnNumber]} or ${rowVar[columnName]}
When looping through a File List (a collection of files), the file information is exported to the Current Item Variable specified on the For Each Loop. For instance, to access the full path of the file, use the following syntax in a task under the For Each Loop:
${file}
To access specific file attributes, use the following syntax:
${file:size}
For a complete list of attributes, refer to the Variable Types reference.