Consider the following examples from the Iteration Examples model in the Vehicle Insurance Demo repository. Assume that there are two drivers:
• One driver with 2 claims,
• One driver with 1 claim.
'
Figure 3-6: Data Iteration
The ‘Claim Example n’ decision groups all have context on the root node, which is always a factor of one and so this does not affect iterations.
Claim Example 1: The Claim decision group will execute 3 times, one time for each claim in the document. This means that any child decision/decision group of Claim would also iterate 3 times, plus its own iterations, if any.
Claim Example 2: The Named Driver decision group will iterate 2 times, once for each driver. The Claim decision group beneath it is within the context of its parent (Named Driver) and will execute within that context. Therefore it will execute 2 times for the first named driver and 1 time for the second named driver; 3 claims in total, the same as Example 1. If we were only processing claims, these examples would be equivalent; you would use Example 2 if you also had additional decisions/decision groups to operate at the Named Driver level.
Claim Example 3: As with Example 2, the lowest level Claim decision group will operate within the context of the higher one. The higher level group will execute 3 times (same as Example 1), and the next level down will execute 3 times for each of its parents, giving 9 executions in total. This creates the ability to recursively process the claims – for instance to see if any claims a duplicates, when you would have to check whether any one claim was identical to any other claim.
Claim Example 4: The decision on claim amount (assume that we are calculating an amount) will execute once for each claim, giving 3 times.
Claim Example 5: The Claim Amount decision is operating within the context of the parent Claim group. Therefore, it will only execute 1 time for each claim, giving 3 times in total, the same as Claim Example 4.
Claim Example 6: Again Claim Amount is executing within the context of its parent, and so will execute the same number of times as per Example 3.
The above discussion describes how decisions and decision groups iterate based on the frequency of data in collections.