Like the if command, the while command executes a series of actions based on whether a specified condition is true. Unlike the if command, the while command creates a processing loop in which actions are executed repeatedly as long as the specified condition remains true.
When processing reaches a while command, DataEase evaluates the condition that follows the keyword while. If the specified condition is true, DataEase executes all the actions that follow the keyword do until it reaches the corresponding end command.
DataEase then reevalutes the original condition. If the condition is still true, DataEase executes the do action series again. If the condition is false, processing passes to the first action following the end command for the while statement.
Syntax
while CONDITION do
ACTION 1 .
[ACTION 2 .
.
.
ACTION N .]
Frequently, a while command specifies an initial condition that is modified during each pass through the loop (for example, a counter). Any action that modifies the value to be reevaluated must be included in the loop (i.e., it must precede the end command that terminates the loop.)
Example
define temp "CRUISE TICKET NUM" Number .
assign temp CRUISE TICKET NUM := 0 .
while temp CRUISE TICKET NUM < 1000 do
temp CRUISE TICKET NUM := temp CRUISE TICKET NUM + 1 .
jointext ( " Boarding Pass No.: " ,
This script tells DataEase: (1) Create (define) a temporary variable called CRUISE TICKET NUM, (2) give (assign) an initial value of 0 to the CRUISE TICKET NUM variable, (3) print a series of labels joining the words Boarding Pass No.: to the number currently stored in the CRUISE TICKET NUM variable, (4) while printing the labels, increment the variable by one each time a new label is printed, and (5) when the value of the variable reaches 1000, stop printing labels.
The while command tells DataEase to reevaluate the value of the variable each time it prints a label. As long as that value is less than 1000, DataEase prints another label. When the value of the variable reaches 1000, DataEase stops performing the action following the do keyword.
Product: Dataease [{8}]FIVE. Written by Luca 31/07/13 at 13:21:39
Product: Dataease [{8}]FIVE. Written by DataEase 31/07/13 at 13:23:50
Product: Dataease [{8}]FIVE. Written by Adrian Jones 02/08/13 at 14:04:19
Product: Dataease [{8}]FIVE. Written by DataEase 02/08/13 at 14:34:42
Product: Dataease [{8}]FIVE. Written by DataEase 05/08/13 at 13:40:19
Product: Dataease [{8}]FIVE. Written by DataEase 05/08/13 at 13:41:53
Product: Dataease [{8}]FIVE. Written by DataEase 01/10/13 at 09:16:45
Product: Dataease [{8}]FIVE. Written by Graham Brown 02/02/14 at 10:50:34
Product: Dataease [{8}]FIVE. Written by DataEase Tech Sup 03/02/14 at 08:57:00
Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 03/02/14 at 11:31:26
Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 04/02/14 at 07:59:18
Product: Dataease [{8}]FIVE. Written by DataEase Tech Sup 04/02/14 at 10:04:40
Product: Dataease [{8}]FIVE. Written by Peter Birney, PB Associates 04/02/14 at 10:21:41
Product: Dataease [{8}]FIVE. Written by Graham Brown 05/02/14 at 14:58:33
Product: Dataease [{8}]FIVE. Written by Jeyarajah Arulrajah 07/12/14 at 17:19:00
Product: Dataease [{8}]FIVE. Written by DataEase 09/12/14 at 11:46:29
Product: Dataease [{8}]FIVE. Written by George Washington 16/10/15 at 07:08:04
Product: Dataease [{8}]FIVE. Written by DataEase 16/10/15 at 12:07:02