Easy to Create, Easy to Change - Easy to use!

Command::

else



Parameters


Returns/Result


Examples


Reference

else

Type

Procedural Command component

Purpose

The else keyword is a component of the if command syntax.

The if command executes one of two different actions (or series of actions) based on whether the specified condition is true or false. When processing reaches an if command, DataEase evaluates the condition that follows the keyword if. If the specified condition is true, DataEase executes all the actions which follow the keyword then until processing reaches the corresponding end or else command. If the specified condition is false, DataEase executes all the actions that follow the keyword else until processing reaches the corresponding end command. If there is no else, DataEase jumps directly to the statement following the end command.

Syntax

if CONDITION then

 ACTION 1 .

 [ACTION 2 .

  ACTION 3 .]

[else

 ACTION 1 .

 [ACTION 2 .

 ACTION 3 .]]

end

 

Example

for MEMBERS ;

if highest of RESERVATIONS DATE < 01/01/99 then

delete records

else

delete records in RESERVATIONS

with ( DATE < 01/01/99) .

end

end

 

This script tells DataEase: (1) For each MEMBERS record, find the most recently dated record in the related RESERVATIONS table, (2) if the most recent reservation is dated before January 1st, 1999, delete the MEMBERS record, and (3) if a member's most recent reservation is dated on or after January 1st, 1999, delete all of that member's RESERVATIONS records dated prior to 1999. 

Note that the first end marks the end of the if command that selects which records to delete. The second end marks the end of the for command that selects the records from the Primary table.

See Also


On the forum about else

On the blog about else