Sequential Conditions - the MapValue() function
The MapValue() function allows a calculated field to perform a series of value comparisons until it finds a matching value, then returns a specific value for that result.
The function is provided a specific field to evaluate, and one or more sets of paired conditions. An optional Default value can be provided.
The function evaluates each condition in order. As soon as a condition evaluates as true, the corresponding value is returned and the operation is complete. Subsequent conditions are not evaluated.
The format is as follows:
MapValue(p0, p1, p2, p1, p2, …, p3, p4)
P0 |
Placeholder for the target field to be evaluated. |
P1 |
Each P1 parameter must have a matching P2 parameter. These are the paired conditions and return results. The condition can be a static value, placeholder, or another function. |
|
The condition value must match the value of the target field exactly, or the function will move on to the next condition. |
P2 |
Each P2 parameter must have a matching P1 parameter. These are the paired conditions and return results. The return result can be a static value, placeholder, or another function. |
P3 |
The P3 parameter must have a matching P4 parameter. This parameter is optional, and should contain the text "Default". This condition will be used when all other listed conditions fail. If the P3 and P4 parameters are not included, the function will return null if all other listed conditions fail. |
P4 |
The P4 parameter must have a matching P3 parameter. This parameter is optional, and returns the default value if all other conditions fail. |
Tips:
Because the condition and target values must match exactly, this function may not be useful for evaluating field types where the user can enter values directly. This is best used with selection fields such as radio buttons and checkbox groups, or calculated fields that produce predictable results.
When using target fields that can contain multiple values, such as checkbox groups, multiple values are saved differently than single values. A single selection may be saved as "Value1", while multiple values are saved as "Value1|Value2". Individual condition and return pairs must be created for each combination of values that should produce a result.
The Include/Exclude field type allows the selection of multiple values, however the order of the selected values can change while navigating within the workflow. These changes can alter the results of the MapValue function.