Enform Plus Reference Manual

Enform Plus Language Elements
Enform Plus Reference Manual422684-001
3-17
Qualification Aggregates
Qualification Aggregates
Qualification aggregates must be specified in a WHERE clause. When specifying a
qualification aggregate, follow these rules:
Qualification aggregates cannot be nested; that is, one aggregate cannot be used as
the argument for another aggregate.
A qualification aggregate can contain an embedded WHERE clause.
The embedded WHERE clause can contain another qualification aggregate; however,
that qualification aggregate must be computed OVER ALL.
All field names used for each individual qualification aggregate expression (the field
being aggregated, any field name appearing in an expression being aggregated, any
field name appearing in the WHERE clause associated with an aggregate, and any
over-item) must come from the same database record.
The UNIQUE syntax cannot be used with an aggregate computed over an over-
item.
Qualification Aggregate With OVER ALL Syntax
When you specify a qualification aggregate without specifying either OVER or OVER
ALL, Enform Plus uses OVER ALL by default. Enform Plus computes the value for the
qualification aggregate over all the records in the original database (not over the target-
records). For example:
LIST odetail,
WHERE quantity > AVG (quantity );
restricts the records returned from odetail to those whose quantity field is greater
than the average of all the values of the quantity field.
Qualification Aggregates With OVER Syntax
When a qualification aggregate is used with the OVER syntax, Enform Plus computes
one value for each over-item group. When the WHERE clause is evaluated, Enform Plus
uses the qualification aggregate value for the particular group to restrict the records
selected. Figure 3-5
on page 3-18 shows a query outline and the process that occurs
when the OVER syntax is used.