Skip to main content

Celonis Product Documentation

STATIC CASE WHEN
Description

STATIC CASE WHEN evaluates a list of static conditions and replaces itself with the expression for the first static condition that is true.

Syntax

A STATIC CASE WHEN requires an ELSE, as at least one of the conditions must be met for there to be an expression that replaces the STATIC CASE WHEN.

 STATIC CASE WHEN static_condition THEN expression [ WHEN static_condition THEN expression ]* ELSE expression END
NULL handling

If a static condition evaluates to NULL, it is treated as if it was false.

Examples

[1]

TO_STRING does not support FLOAT and STRING columns as inputs, and it requires an additional format argument for DATE inputs. With STATIC CASE WHEN and COLUMN_TYPE, we can write a string conversion query that is independent of the data type of a column.

Query

Column1

         STATIC CASE WHEN COLUMN_TYPE ( "Table"."Column" ) = 'INT' THEN TO_STRING ( "Table"."Column" ) WHEN COLUMN_TYPE ( "Table"."Column" ) = 'DATE' THEN TO_STRING ( "Table"."Column" , FORMAT ( '%Y-%m-%d' ) ) WHEN COLUMN_TYPE ( "Table"."Column" ) = 'FLOAT' THEN CONCAT ( '' , "Table"."Column" ) ELSE "Table"."Column" END
        

Input

Output

Table

Column : int

1

2

3

Result

Column1 : string

'1'

'2'

'3'

See also: