FormulaMap() : When and where?

@Ander pretty much explained it.

When: any time you need to iterate over a collection — i.e. do something with each element of the collection individually, such as transform it by running through some functions, or running an action on each item individually.

Where: in any calculation formulas as well as in actions.

A collection: can be a list of rows coming from a Filter(), as well as from a Lookup cell, as well as a hard-coded List(@ref1, @ref2...), or a list of values (strings, numbers etc).

A formula within the FormulaMap() is executed for each element of the incoming collection in order. An element that the formula currently calculates is stored in a CurrentValue variable. Inner FormulaMap(), Filter(), ModifyRows(), and some other functions that do their own iteration and define their own CurrentValue will override that outer CurrentValue and you’ll use access to that — there are some tricks how to address that in different contexts.

6 Likes