coalesce - script and chart function
The coalesce function returns the first of the parameters that has a valid non-NULL representation. Any number of parameters can be used.
Syntax:
coalesce(expr1[ , expr2 , expr3 , ...])
Return data type: dual
Argument | Description |
---|---|
expr1 | The first expression to check for a valid non-NULL representation. |
expr2 | The second expression to check for a valid non-NULL representation. |
expr3 | The third expression to check for a valid non-NULL representation. |
Example | Result |
---|---|
Coalesce(ProductDescription, ProductName, ProductCode, 'no description available') |
This expression will select between three different product description fields when some fields do not have values for the product. Following the order listed in the function, the first field with a non-null value is returned. If none of the fields contain a value, the result will be no description available. |
Coalesce(TextBetween(FileName, '"', '"'), FileName) |
This expression will trim potential enclosing quotes from the field FileName. If the FileName given is quoted, these are removed, and the enclosed, unquoted FileName is returned. If the TextBetween function doesn't find the delimiters it returns null, which the Coalesce rejects, returning instead the raw FileName. |