Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : COUNT-OF function

COUNT-OF function

Returns an INTEGER value that is the total number of selected records in the file or files you are using across break groups.


COUNT-OF ( break-group )
The name of a field or expression you named in the block header with the BREAK BY option.


This procedure sorts all customers by state and then calculates the percentage of the total number of customers that are in each state. The COUNT-OF function provides the calculation with the number of customer records in the database.
FOR EACH Customer NO-LOCK BREAK BY Customer.State:
DISPLAY Customer.CustNum Customer.Name Customer.SalesRep Customer.State.
ACCUMULATE Customer.State (SUB-COUNT BY Customer.State).
IF LAST-OF( Customer.State) THEN
    DISPLAY 100 * (ACCUM SUB-COUNT BY Customer.State Customer.State) /
      COUNT-OF(Customer.State) FORMAT "99.9999%"
      COLUMN-LABEL "% of Total!Customers".

See also

Aggregate phrase