Kbase P108320: 4GL: How to tally the number of times a given field value occurs in a table?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  01/09/2005 |
|
Status: Unverified
GOAL:
4GL: How to tally on the number of times a given field value occurs in a table?
FIX:
The following code sample demonstrates how to list some fields from the Customer table while keeping a country-by-country tally (cumulative number of customers per each country):
DEFINE VARIABLE iCount AS INTEGER NO-UNDO.
FOR EACH Customer NO-LOCK BREAK BY Country:
iCount = iCount + 1.
IF FIRST-OF(Country) THEN iCount = 1.
DISPLAY
CustNum FORMAT "ZZZZZ"
Name FORMAT "X(25)"
Country FORMAT "X(12)"
iCount FORMAT "ZZZZZ"
WITH STREAM-IO WIDTH 132.
END.