User Tools

Site Tools


syntax:functions:coalesce

Coalesce(value1, value2…)

Category: Special function


Description

This function returns the first value in the argument list that is not an empty value.


Alternate formats

This function can take from 2 to 6 values as arguments.

coalesce(value1, value2, value3, value4, value5, value6)


Arguments

ArgumentTypeDescription
valueNAnyA value tested to determine whether it represents an empty value or not.

Return value type: Any (The type of the returned, non-empty value.)


Remarks

To use the function with more than 6 arguments, nest function calls. Keep in mind that arguments are evaluated before a function is evaluated.

If all arguments are empty values, an empty value is returned.


Examples

coalesce(empty(), 'ABC', '')  //Returns 'ABC'
coalesce(empty(), '', 'ABC')  //Returns '' (Empty text value but not an empty value.)
coalesce(empty(),empty())  //Returns an empty value  (All arguments are empty values.)
coalesce(empty(), coalesce('ABC',empty()) ,'XYZ')  //Returns 'ABC'  (Nested functions)


See also

syntax/functions/coalesce.txt · Last modified: 2021/09/12 23:45 by craigt