Progress
Language Tutorial
for Character


Defining Selection Criteria

Conditional expressions used to select particular records from a database table or tables are called the selection criteria. Progress has many options for specifying selection criteria, but the most commonly used is the WHERE phrase. You’ll learn about selecting records in later chapters. This chapter shows you how to create the expressions you’ll use with WHERE. This is the general syntax for WHERE.

SYNTAX
WHERE [ expression ] 

Earlier you saw that the FOR EACH statement goes through every record in a database table. When you attach WHERE to FOR EACH, FOR EACH goes through each record and evaluates the WHERE expression using each record. If the expression for a particular record evaluates to TRUE, then Progress executes the statements inside the FOR EACH block. If it evaluates to FALSE, Progress moves on to the next record in the table. Thus, FOR EACH selects records based on the WHERE expression, as shown in the following example:

FOR EACH Customer WHERE Customer.Cust-Num > 30:
  DISPLAY Cust-Num Name Balance.
END. 

So, as Progress cycles through the Customer records, it displays information from only those records where the customer number is greater than 30.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095