Find highest value in more than two numbers

Hello. Is it possible to compare the values (numbers) contained within some child variables (of a structure variable) to get the highest number so I can do something with it? I found a ‘compare two numbers’ condition and the max() function, but I want to compare more than two numbers.

e.g. childOne = 3, childTwo = 1, childThree = 2.

I would like to compare the values 3, 1 and 2, and end up with 3 (childOne) identified as the highest. Once I have that value I could, for example, add 1 and assign that new number to childFour. Note that the structure variable might have more children than the ones I want to compare; I would want to target some of them, not all of them. I was hoping for an expression to do something like this:

giveMeTheMaxPleaseOf((childOne), (childTwo), (childThree)) + 1)

Thank you.

The only way I know how is to start with a variable with an absurdly low number, then use the for each child event to iterate over each child, setting the variable to the mac of variable & child value.

1 Like

Thanks MrMen. I also had the following idea after reading an old post:

If I capture the current highest value in a variable, then compare new numbers against it… something like:

Condition: If childOne < CurrentHighestNumber
Action: then add 1 to CurrentHighestNumber and assign it to childOne
Action: otherwise assign 1 to childOne and CurrentHighestNumber*

*Covers the possibility that CurrentHighestNumber is zero.