Creating a list *until* a condition is met

the simplest UNTIL solution is to use a FormulaMap() and have an SwitchId() inside that loop that will execute the required code if the UNTIL condition is false, and will do NOTHING otherwise.

so if i have a table, T, with prices column, P, and i want to do some action, XXX, until the sum of prices exceeds N then i could write

T.P.Formulamap(
    SwitchIf( SUM<N,
        RunActions(
            XXXX,
            SUM.SetControlValue(SUM+CurrentValue)
        )
)

This will loop over ALL the rows in T
But will only sum the price and do the XXXX action while SUM<N

There are more complex ways for when you dont know how many iterations there will be.
see these for two different approaches

max

2 Likes