PreviousNextIndex

Aggregate phrase

Identifies one or more values to calculate based on a change in an expression or a break group.

Syntax

{   AVERAGE 
  | COUNT 
  | MAXIMUM 
  | MINIMUM 
  | TOTAL 
  | SUB-AVERAGE 
  | SUB-COUNT 
  | SUB-MAXIMUM 
  | SUB-MINIMUM 
  | SUB-TOTAL 
} ... [ LABEL aggr-label ] [ BY break-group ] ... 

AVERAGE
COUNT
MAXIMUM
MINIMUM
TOTAL
SUB-AVERAGE
SUB-COUNT
SUB-MAXIMUM
SUB-MINIMUM
SUB-TOTAL
BY break-group
LABEL aggr-label
Examples

This procedure lists the customer information for all customers (categorized by country) and a subtotal of each country’s balance. If you use TOTAL instead of SUB-TOTAL, the AVM displays a grand total.

r-aggreg.p
FOR EACH Customer NO-LOCK BREAK BY Customer.Country: 
  DISPLAY Customer.Name Customer.Country Customer.Balance  
    (SUB-TOTAL BY Customer.country). 
END. 

In the following procedure, the AVM displays the result of the COUNT aggregate even though no accumulation has occurred. In this example, COUNT displays as 0.

r-agcnt.p
DEFINE VARIABLE prntr AS LOGICAL NO-UNDO. 
FOR EACH Item NO-LOCK: 
  IF prntr THEN 
    DISPLAY Item.ItemName Item.Price(COUNT) WITH FRAME pr. 
END. 

In the following procedure, the AVM uses “Avg. Credit Limit” and “Max. Credit Limit” as the labels for the AVERAGE and MAXIMUM aggregates respectively.

r-aglim.p
FOR EACH Customer NO-LOCK: 
  DISPLAY Customer.Name Customer.CreditLimit 
    (AVERAGE LABEL "Avg. Credit Limit" 
     MAXIMUM LABEL "Max. Credit Limit"  
     TOTAL) WITH FRAME frame1 12 DOWN. 
 END. 

Notes
See also

ACCUMULATE statement, FOR statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex