The CASE function allows you to perform multiple conditional tests on a set of expressions within a single statement. When a test evaluates to true, a corresponding output is generated. Outputs may be a literal or expression.

For more information on the IF function, see IF Function.


case([ Qty <= 10, 'low_qty', Qty >=100, 'high_qty', 'med_qty'])

Output: Returns a text string based on the evaluation of the Qty column:

In the following, If the testX expression evaluates to true, then the resultX value is the output.

case([test1, 'result1',test2, 'result2', testn, 'resultn','result_else'])

ArgumentRequired?Data TypeDescription
test1, test2, testnYexpressionExpression that is evaluated. Must resolve to true or false
result1, result2, result2, result_elseYstringQuoted string that is written if the corresponding test expression evaluates to true.

All of these expressions can be constants (strings, integers, or any other supported literal values) or sophisticated elements of logic, although the test expression must evaluate to a Boolean value.

test1, test2, testn

These parameters contain the expressions to evaluate. This expression must resolve to a Boolean (true or false) value.

NOTE: The syntax of a test expression follows the same syntax as the IF function. For example, you must use the double-equals signs to compare values (status == 'Ok').


Required?Data TypeExample Value
YesExpression that evaluates to true or false(OrderAge > 90)

result1, result2, result2, result_else

If the corresponding test expression evaluates to true, this value is written as the result.

These expressions can literals of any data type or expressions that evaluate to literals of any data type.

Required?Data TypeExample Value
YesLiteral value or expression

See examples below.

Example - Basic Usage

The following data represents orders received during the week. Discounts are applied to the orders based on the following rules:



To determine the day of the week, you can use the following transformation:

You can build the discount rules into the following transform, which generates the Disc column: