image\Dql_0024.gifall

Type

Relational Operator

Purpose

The all operator selects every record in a related table that matches the current record being processed.

Syntax

all TABLENAME|RELATIONSHIP

 [named "UNIQUE RELATIONSHIP NAME" ]

 [with ( selection criteria) ] FIELDNAME;|.

 

Returns

The specified value from every matching record in the related table. The type of value returned is the same as that of the specified field. For example, if you are selecting text fields, the returned value is text.

Usage

The all operator can be only used to specify report output items in a list records command. It cannot be used to specify selection criteria.

Example 1

for MEMBERS with TOTAL DUE > 100 ;

list records

LAST NAME in groups ;

all RESERVATIONS RESERVATION ID ;

all RESERVATIONS TOTAL DUE .

end

 

This script tells DataEase: (1) Select all the MEMBERS records that have a TOTAL DUE greater than $100, (2) find all these members' reservations in the related RESERVATIONS table, and (3) for each record selected from the RESERVATIONS table, list the RESERVATION ID and TOTAL DUE.

The output from this script, arranged in groups by LAST NAME (from the MEMBERS table), might look as shown below:

 

Last Name

Reservation ID

Total Due

Albert

00197

4,760

 

00359

3,220

Anders

00015

4,420

 

00421

2,290

 

00298

2,480

Anderson

00077

4,320

Archer

00085

4,796

Bennington

00002

5,662

Bickford

00141

2,800

 

00356

3,650

Christino

00139

5,450

 

Example 2

Example 2 demonstrates how you can use the all operator to access information from two or more related tables on the same relationship level. The relational operators can also be used to navigate from one table to a third table (which is not directly related) by using an intermediate relationship, as shown in the sixth line of the script.

 

for ACTIVITIES

list records

ACTIVITY in groups ;

all CLUB ACTIVITIES CLUB NAME ;

all MEMBERS LAST NAME ;

all MEMBERS all FAMILY MEMBERS FIRST NAME .

end

 

This script tells DataEase: (1) Select all the ACTIVITIES records and group them by ACTIVITY, (2) find all the related records in CLUB ACTIVITIES and list the name of each club that offers the activity, (3) find all the related records in MEMBERS and list the last name of each member who favors the activity, and (4) find all the related MEMBERS records (for each ACTIVITIES record), and for each MEMBERS record, find all the related FAMILY MEMBERS records and list the value in the FIRST NAME field.

The output from this script, arranged in groups by ACTIVITY, might look as follows:

 

Activity: Baseball

 

Club Name

Last Name

First Name

Playa Blanca

Connelly

John

Cancun

 

Erin

Punta Cana

 

Patrick

Huatulco

 

Mary

St. Lucia

Rada

Amanda

Columbus Island

 

Jerome

 

 

Clarenct

 

Ruggiero

Donato

 

 

Anna

 

DiLorenzo

Lawrence

 

 

Daniel

 

 

Gregory

 

 

Mary Anne

 

Stomboulis

Christos

 

 

Helen

 

Walsh

Ivan

 

 

Emma

 

 

Charlotte

 

 

Ann Marie