CASE operator
The CASE operator creates an action that implements branching.
Syntax
CASE [exclusionType]
WHEN condition1 THEN action1
...
WHEN conditionN THEN actionN
[ELSE elseAction]
Description
The CASE operator creates an action that executes one of the actions passed to it depending on whether the selection conditions are met. Selection conditions are defined using the properties specified in the WHEN block. If a selection condition is met, the action specified in the corresponding THEN block is executed. If none of the conditions is met, the action specified in the ELSE block will be executed if this block is specified.
Parameters
-
exclusionTypeType of mutual exclusion. Determines whether several conditions can be met simultaneously for a certain set of parameters. It is specified by one of the keywords:
EXCLUSIVEOVERRIDE
The
EXCLUSIVEtype indicates that none of the conditions listed can be met simultaneously. TheOVERRIDEtype allows several conditions to be met simultaneously, in this case, the action corresponding to the first met condition is executedThe
OVERRIDEtype is used by default. -
condition1 ... conditionNExpressions whose values determine the selection conditions.
-
action1 ... actionNContext-dependent operators that describe actions that may be called when the corresponding condition is met.
-
elseActionA context-dependent operator that describes an action to be executed if none of the conditions is met.
Examples
test = DATA INTEGER (INTEGER);
caseActionTest(a) {
CASE
WHEN test(a) > 7 THEN MESSAGE '>7';
WHEN test(a) > 6 THEN MESSAGE '>6';
WHEN test(a) > 5 THEN MESSAGE '>5';
}