User Tools

Site Tools


Coalesce(value1, value2…)

Category: Special function


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)


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.)


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.


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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki