coalesce

utility

Returns the first non-null value

Syntax

coalesce(values...)

Parameters

values (any)

Multiple values to check

Returns

any

The first non-null value from the arguments

Examples

Use first available email
Input:
coalesce(.email, .backup_email, "[email protected]")
Output:
"[email protected]"
Return first non-null value or default to 0
Input:
coalesce(.value1, .value2, .value3, 0)
Output:
42

The coalesce() function returns the first non-null value from a list of arguments.

Usage

Use coalesce() to provide fallback values, handle missing data, or select from multiple potential data sources.

Related Functions