Table of Contents

When(condition, expression)

Category: Logical function


Description

This function returns the result of expression if condition is TRUE. Otherwise, it returns empty value.

This function is effectively a shorthand version of if(condition, expression, empty())


Arguments

ArgumentTypeDescription
conditionExpressionThis is an expression or "test" that evaluates to either TRUE or FALSE.
expressionExpressionAny expression.

Return value type: Text, Number, Boolean (the value type of the returned value from expression), or, empty value.


Examples

when(2 + 2 = 4, 'Makes sense') //Returns 'Makes sense'
when(1 + 1 = 4, 'Makes sense') //Returns empty
when([FieldA] = 10, 'FieldA is 10') //Returns 'FieldA is 10' (where [FieldA] is 10)
when([FieldA] = 10, 'FieldA is 10') //Returns empty (where [FieldA] is 20)


See also