You are here:
Additional Functions for Formulas
To build logic into formulas, use these functions with the text, number, and datetime data types.
case
Use a case statement to handle if/then logic. A
case statement always has a pair of where and then statements.
Syntax
case [primary_expr]
when condition
then result_expression
else
default_expression
endParameters
- primary_expression—Optional. Any valid expression to compare against
a set of expressions. The primary expression is compared to the expression in each
whenclause for equivalency. If these expressions are equivalent, the expression in thethenclause will be returned. - condition—The
conditionof acasestatement can take two forms:- An expression that is compared against a set of possible values.
- A boolean expression that evaluates to
true,false, ornull.
- result_expression—The expression returned when the primary_expression satisfies the condition and evaluates to True.
- default_expression—If neither of the previous comparisons evaluate to True, this expression is returned.
coalesce
Use the coalesce function as shorthand for case
statements. This function replaces null values with another value.
Syntax
coalesce(expression1, expression2)Parameters
- expression1—The first column or text string to search for a non-null value.
- expression2—The next column or text string to search for a non-null value.
Example
coalesce(city, null) Returns
Returns the first non-null value. If there isn’t one, then the function returns null.
sequence
Use the sequence function to create a sequence of
numbers or dates by defining the start and end values and the interval between each
value.
Syntax
sequence(start,stop,step)Parameters
- start—A field or number.
- stop—A field or number.
- step—A field, number, or date interval.
Example
sequence(start_field, stop_field, interval 1 day)Returns
Returns an array with one element for each value.

