ForEach Function
Description:
Apply the function to each member of the list.
note
Use "%0" to refer to the current item in the list (see below for examples)
Returns:
Any* (the type of data returned will be the same data type as parameter 2)
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Any* | The list. |
2 | Any | The function applied. |
Example:
When using functions inside a field, remember the field brackets:
{ForEach(LineItemList, (%0* SalesTax)}
Expression | Result |
|---|---|
ForEach( List(1,1,2,3,5), (%0 * 2) ) | List(2,2,4,6,10) |
ForEach( List("","a","bcdedfgh"), Left(%0,2) ) | List("","a","bc") |
ForEach( List(List(),List(1),List(2,3)), Sum(%0) ) | List(0,1,5) |