The Iterator operator provides a looping construct for view models.
Based on criteria you specify, an Iterator repeatedly executes the portion of the flow upstream from its position and accumulates the results. You might use an Iterator if, for example, you need to execute a parameterized input source once for each of a series of dates, sales regions, or customer IDs. You can use the Iterator operator in two ways:
In this approach, which is similar to for loops in most programming languages, the iteration is controlled by a set of expressions specifying the starting and ending conditions, as well as how to increment the loop variables. When you configure the upstream operators (those farther from the Result), you can use variables defined in any Iterator operator downstream from them. In our parameterized input source example, if your Input Source takes a date parameter, you could map the parameter to a Date variable that the Iterator operator increments.
The Iterator operator also gives you the option of controlling the iteration with the results of another branch of the flow, referred to as the range input. This approach is similar to the for each constructs in many programming languages; it allows you to execute the main branch once for each row in the range result set, which resembles a lookup table. (For example, a database operation might return a list of employee IDs, allowing you to execute the main branch of the flow once per employee.) You use expressions to define variables based on the values of each row in the range input source, and you can also use an expression to trigger the premature termination of the loop.
For product-related issues, contact Sybase Technical Support at 1-800-8SYBASE. Send your feedback on this help topic directly to Sybase Technical Publications: pubs@sybase.com