Progress
Language Reference


COUNT-OF Function

Interfaces
OS
SpeedScript
All
All
Yes

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

SYNTAX

COUNT-OF ( break-group ) 

break-group

The name of a field or expression you named in the block header with the BREAK BY option.

EXAMPLE

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.

r-cntof.p
FOR EACH customer BREAK BY state:
  DISPLAY cust-num name sales-rep state.
  ACCUMULATE state (SUB-COUNT BY state).
  IF LAST-OF(state)
  THEN DISPLAY 100 * (ACCUM SUB-COUNT BY state state) / COUNT-OF(state)
    FORMAT "99.9999%"
    COLUMN-LABEL "% of Total!Customers".
END. 

SEE ALSO

Aggregate Phrase


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095