Simplicty and flexibility!


Support::

While


Parameters


Returns/Result


Examples


Reference

while

while

Type

Procedural Command

Purpose

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 .]

 end

 

Usage

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 .

list records

jointext ( " Boarding Pass No.: " ,

temp CRUISE TICKET NUM) .

end

 

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.

See Also


On the forum about While

[@EOF@]...

Product: . Written by alembagheri tahmas 07/12/13 at 13:37:32

Hi there,I am trying to use an external MySQL DB in dataease. I have successfully create the ODBC link and added the DB to dataease. I can also access the DB from dataease. Now, just for testing purposes, I am trying to create a simple report b...

Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17

no se pude exportar ahora archivos a pdf, ni a excel o otros cosa mala. en verdad creo que hace faltaen las versiones anteriores me funcionaba mas o menos bien.&nbsp;le hace falta a los aplicativos que se desarrollan en Dataeasegr...

Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11

Thanks. Anyway I'm trying to use this fuction but it seems to me that it doesn't work on 8.2. I tried also in a DQL.There's something wrong?<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA9IAAAJ3CAYAAAB4NWk3AAAAAXNSR0IArs4...

Product: . Written by Marco Marchesi 15/02/16 at 14:50:46

[@EOF@]...

Product: Dataease [{8}]FIVE. Written by Chamil Rajindra 21/02/19 at 10:17:46

Thanks for the very good explanation!AS...

Product: . Written by afonso santos 28/10/19 at 00:50:14

I am pleased to see that the migration from Dos 4.53 is then sa 5.5 works. A really useful thing would be a compiler of SQL languages. Will you get there?Original Text:Mi compiaccio a vedere che la migrazione da Dos 4.53 è poi sa 5.5 funzio...

Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44

How can i delete a Style sheet?...

Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10

I run W7 and since a few days&nbsp;Dataease 8.5 is not starting any more, do you have an idea? i installed it again but that did not help....

Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40

[@EOF@]...

Product: . Written by Hiralal Rampul 01/12/21 at 17:47:10

On the blog about While


dg3_HelpView