
Aggregates
ENFORM Language Elements
3–18
058057 Tandem Computers Incorporated
In this example, AVG target-item-1 prints as a separate report column with a non-
blank entry only on the first line of each new by-item-2 group. This entry represents
the average of target-item-1 over the by-item-2 group.
When a target aggregate is specified in a FIND statement with the OVER syntax, the
aggregate value is present only in the first target-record for a by-item. This field is
blank for all other target-records.
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 data base 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 assumes OVER ALL. ENFORM computes the value for the
qualification aggregate over all the records in the original data base (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 computes
one value for each over-item group. When the WHERE clause is evaluated, ENFORM
uses the qualification aggregate value for the particular group to restrict the records
selected. Figure 3-5 shows a query outline and the process that occurs when the OVER
syntax is used.
Содержание ENFORM 058057
Страница 5: ...New and Changed Information iv 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 6: ...New and Changed Information 058057 Tandem Computers Incorporated v...
Страница 18: ...Preface xvi 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 19: ...Preface 058057 Tandem Computers Incorporated xvii...
Страница 21: ...Notation Conventions xviii 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 25: ...ENFORM Terminology Introduction 1 4 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 121: ...TITLE Statement Statements 4 50 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 227: ...ENFORM Procedures ENFORM Syntax Summary A 16 058057 Tandem Computers Incorporated This page left intentionally blank...
Страница 269: ...Glossary Glossary 4 058057 Tandem Computers Incorporated This page left intentionally blank...