COALESCE

Returns the first non-empty value, or NONE if all values are empty. A value is non-empty if ISNOTEMPTY(<expr>) returns true. If there are no values passed in, it returns NONE.

Syntax

=COALESCE()

=COALESCE(expr1)

=COALESCE(expr1, expr2, ..., exprN)

Arguments

ArgumentTypeDescription
exprNString, Array or ObjectAny value. The first non-empty value will be returned

Examples

=COALESCE()NONE
With no arguments, COALESCE returns NONE.

=COALESCE("A")"A"
The only argument is non-empty, so it gets returned.

=COALESCE("", "B", NONE)"B"
Returns the first non-empty string.

=COALESCE(OBJECT(), NONE, [])NONE
Every argument is empty, so COALESCE returns NONE.

=COALESCE(" ", OBJECT("A", 1))OBJECT("A", 1)
An object with keys is not empty, but a string of whitespace is.