Qualification Aggregate with an Embedded WHERE Clause
If a qualification aggregate contains a WHERE clause that restricts the records for the
aggregate calculation, ENFORM processes the embedded WHERE clause before the
aggregate. If any record for an over-item does not satisfy the restriction specified in the
embedded WHERE clause, ENFORM excludes that record from the aggregate
calculation.
For example consider Figure 3-6. This figure shows an ENFORM query containing a
qualification aggregate with a WHERE clause. The query prints the part number and
the amount in stock of all the parts where the price of the part is greater than the
average price of all parts not in stock.
Figure 3-6. Qualification Aggregate with Embedded WHERE Clause
OPEN parts;
LIST partnum,
inventory,
WHERE price GT AVG (price WHERE inventory LT 0);
The report produced is:
Part Number
INVENTORY
212
244
1403
5502
5504
5505
7102
Aggregates and Scale
All the aggregates except COUNT take their display format from the formats of the
input values. (COUNT always returns a value with a scale of zero, or no digits to the
right of the decimal point.) Consequently, if a field is defined as an integer and the
aggregate yields a fractional value, the aggregate returns only the whole portion of the
value. If the field is defined as a decimal, the value returned is accurate to the number
of decimal places provided by the DDL data definition for the field.
058057 Tandem Computers Incorporated
7
3
21
6
–1
0
20
ENFORM Language Elements
Aggregates
3–21