
The case command functions like an if-then-else statement with multiple ifs. It tells DataEase to compare an expression to a series of values and execute a different action (or group of actions) based on which comparison is true.
When processing reaches a case command, DataEase compares the expression that follows the case command to each of the statements specified by the keyword value.
If the first comparison is true, DataEase executes all the actions between that value statement and the next value statement.
If the first comparison is not true, the case expression is compared to the next value statement. This comparing of values continues in top-to-bottom sequence from one value statement to the next until a true comparison is made.
If none of the specified value comparisons are true, DataEase executes the actions specified after the keyword others. If the others keyword is not present, DataEase executes none of the specified actions. It continues processing the remainder of the script.
As soon as the actions following any single statement are executed, processing passes to the first action following the end command for the case structure.
Syntax
ACTION SERIES 1 .
ACTION SERIES 2 .]
ACTION SERIES 3 .]
DEFAULT ACTION SERIES .]
The case command requires a case expression, at least one value statement, and an end command. Subsequent value statements, actions, and the others keyword are optional. If others is used, it must follow the last value statement.
The case expression must be enclosed in parentheses. It can be a field, a variable, or any other expression except a boolean expression (true or false). Each comparison value can be a constant, a variable, an expression, or a range of values.
An action can specify any valid procedure command including another if, while, or case command. Each nested command must be completed before processing passes to the first action after the end command (see the nested actions entry in this Lexicon).
When case commands are nested, the first end corresponds to the last preceding case, and each case command must be matched with a corresponding end command. This rule applies to all nested Procedural commands (including case, for, if, and while).
When you select case from the command pick list, DataEase automatically enters the opening ( (parenthesis).
Example
call menu "CLUB ADMINISTRATION" .
run procedure "MAINTENANCE" .
record entry "MEMBERS" .
end
This script tells DataEase: (1) If the current user is Frank, display the MAIN MENU document, (2) if the current user is Tom, display the CLUB ADMINISTRATION menu document, (3) if the current user is Carol, run the MAINTENANCE procedure, and (4) if the current user is anyone other than Frank, Tom, or Carol, display the MEMBERS form.
Product: Dataease [{8}]FIVE. Written by Dave Clements 12/12/14 at 20:03:52
Product: Dataease [{8}]FIVE. Written by DataEase 12/12/14 at 22:16:22
Product: Dataease [{8}]FIVE. Written by Dave Clements 12/12/14 at 22:20:46
Product: Dataease [{8}]FIVE. Written by DataEase 12/12/14 at 22:28:40
Product: Dataease [{8}]FIVE. Written by Dave Clements 13/12/14 at 11:22:13
Product: Dataease [{8}]FIVE. Written by DataEase 13/12/14 at 11:41:35
Product: Dataease [{8}]FIVE. Written by Dave Clements 13/12/14 at 11:49:57
Product: Dataease [{8}]FIVE. Written by DataEase 13/12/14 at 12:18:56
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 09:10:50
Product: Dataease [{8}]FIVE. Written by Simon B 20/03/15 at 10:36:17
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 11:01:22
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 10/04/15 at 08:58:59
Product: Dataease [{8}]FIVE. Written by DataEase 10/04/15 at 11:12:36
Product: Dataease [{8}]FIVE. Written by DataEase 30/12/15 at 12:42:26
Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 30/12/15 at 14:23:03
Product: Dataease [{8}]FIVE. Written by DataEase 30/12/15 at 15:36:06
Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 04/01/16 at 16:35:23
Product: Dataease [{8}]FIVE. Written by DataEase 05/01/16 at 08:32:18
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 04/04/16 at 12:47:14
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 07:07:10
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 08:13:37
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 08:26:41
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 08:56:14
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 09:10:21
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 10:35:05
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 10:52:58
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 11:30:45
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 11:54:59
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 12:08:07
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 13/07/16 at 12:12:28
Product: Dataease [{8}]FIVE. Written by DataEase 13/07/16 at 12:21:10
Product: Dataease [{8}]FIVE. Written by Rainer 19/03/17 at 19:44:04
Product: Dataease [{8}]FIVE. Written by DataEase 19/03/17 at 19:49:36
Product: Dataease [{8}]FIVE. Written by Rainer 31/03/17 at 10:49:37
Product: Dataease [{8}]FIVE. Written by DataEase 31/03/17 at 14:31:11
Product: Dataease [{8}]FIVE. Written by Rainer 31/03/17 at 16:45:35
Product: Dataease [{8}]FIVE. Written by DataEase 31/03/17 at 17:01:26
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 10:47:38
Product: Dataease [{8}]FIVE. Written by DataEase 10/04/15 at 16:27:00
Product: Dataease [{8}]FIVE. Written by DataEase 17/03/17 at 17:09:04
Product: Dataease [{8}]FIVE. Written by Rainer 17/03/17 at 21:12:27
Product: Dataease [{8}]FIVE. Written by DataEase 19/03/17 at 20:31:09