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 by the expressions specified in the WHEN blocks. 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:
EXCLUSIVE- none of the conditions can be met simultaneously.OVERRIDE- several conditions can be met simultaneously; in this case the action corresponding to the first met condition is executed. 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';
}