Iterative calculations¶
Iterative calculations run the same projection node more than once with different input values.
In Autory, this is usually driven by the loopTable function.
Instead of creating one projection node per policy, scenario, or sensitivity point, you can store the inputs in a table and let Autory calculate one iteration for each row.
How looped calculations work¶
When a variable formula uses loopTable, Autory treats the referenced table as an iteration domain:
- It reads the table used by
loopTable. - It creates one iteration for each row in that table.
- During each iteration,
loopTablereturns the value from the current row and requested column. - It writes the per-iteration results to the projection node output workbook.
- It also writes aggregated results for variables with a configured aggregation method.
For example, if a projection node contains this formula:
loopTable("t_Policies", "SumAssured")
and t_Policies has 1,000 rows, the projection node is calculated 1,000 times.
On each iteration, the formula returns the SumAssured value from the current policy row.
Reusing the same loop¶
Multiple variables can read different columns from the same loop table:
loopTable("t_Policies", "PolicyID")
loopTable("t_Policies", "SumAssured")
loopTable("t_Policies", "Premium")
These formulas reuse one loop. They do not create three separate sets of iterations.
Nested loops¶
If a projection node uses loopTable with more than one table, Autory calculates the cartesian product of those tables.
For example, a policy table with 1,000 rows and a scenario table with 3 rows produces 3,000 iterations.
The order in which loops are encountered in the variable set determines the nesting order.
See loopTable for a detailed example.
Aggregation¶
Looped calculations often need both detailed results and summary results.
The ResolveAggregation column in the Variables table controls how each variable is aggregated across iterations.
Common methods include Sum, Mean, Max, Min, First, and Last.
Use Ignore for variables that should only appear in detailed per-iteration results.