Using iteration with an embedded flow
Iteration settings specify how an embedded flow should process incoming records. By default, an embedded flow processes each record individually just as any other stage in the flow would. But if you use iteration, you can process groups of records together, which can be useful for things like performing comparisons or calculations based on groups of records rather then the entire set of input data. You can also use iteration to set stage options based on the data in each record.
There are two kinds of iteration: per-record iteration and per-group iteration. In per-record iteration, an embedded flow process one record at a time and the result is sent along to the next stage following the embedded flow. Per-record iteration is useful if you want to set stage options on a record-by-record basis using field values.
In per-group iteration, records are grouped by a key field and the embedded flow processes each group. All the records in a group are processed in one iteration, then the group is written to the next stage following the embedded subflow. Use per-group iteration to perform processing on groups of related records, as well as to set stage options to use when processing the group of records. For example, you might want to group records by customer ID so that you can perform an analysis of each customer's records, perhaps to determine which store each customer visits most often.
You should consider the impact on performance when using iteration. Each time a new iteration starts, there is some overhead during the initialization of the embedded flow, and this overhead can be significant, especially if you have embedded flows within other embedded flows. For example, if the an embedded flow iterates 1,000 times and it contains within it another embedded flow that also iterates 1,000 times, the total number of iterations would be 1,000,000. Using per-record iteration has a more significant impact on performance since each record kicks off a new iteration.