Find the Largest Number in a List
Occasionally, you may need to find the largest number in a list of numbers. For example, if you have a repeated dialog in your template that gathers information about an individual's assets, you may want to find out which asset has the largest value.
You can use the following computations to find the largest answer for a repeated Number variable, or the largest number in a group of Number variables. The first computation begins by setting the result to the first answer for Num Var. Then, as the dialog is repeated, the computation result is compared to each answer for Num Var, and if a larger number is found, the result is set to the larger number. When the dialog reaches the last repetition, the result is the highest value.
The second computation uses the MAX expression to compare four separate Number variables. Following the order of operations, as indicated by the parentheses, the computation first compares Num Var 3 with Num Var 4 to find which number is larger. The result of that comparison is then compared with Num Var 2, and the maximum number from that comparison is then compared with Num Var 1. This final comparison then returns the largest of all four Number variables.