coalesce()

Evaluates a list of expressions and returns the first non-null (or non-empty for string) expression.

Syntax

coalesce(arg,arg_2,[arg_3,...])

Learn more about syntax conventions.

Parameters

Name Type Required Description
arg scalar ✔️ The expression to be evaluated.

Note

  • All arguments must be of the same type.
  • Maximum of 64 arguments is supported.

Returns

The value of the first arg whose value isn't null (or not-empty for string expressions).

Example

print result=coalesce(tolong("not a number"), tolong("42"), 33)

Output

result
42