image\Dql_0024.gifcount

Type

Conditional Statistical Operator

Purpose

The count operator counts the number of records in the table being processed. It can also be used to count the number of times a condition specified by a comparison of two values is true. The result usually appears as a statistic in the summary area at the end of a report or group.

Syntax

CONDITION : count [other statistical operators];|.

Usage

To count all the records that meet a specified condition, enter :count after the condition as shown in Example 1. . When applied to a field, it counts how many times that field has a value. To count all the records processed by a script, use a statement that is true for every record, such as "A" = "A". This method is shown in Example 2.

Example 1

for MEMBERS with STATE = "NJ" ;

list records

LAST NAME in order ;

TOTAL DUE ;

TOTAL DUE > 40 : count .

end

 

This script tells DataEase: (1) List the MEMBERS records showing each member's LAST NAME and TOTAL DUE, and (2) count the number of members who have an TOTAL DUE greater than $40. The output from this script might look as follows:

 

Last Name

Total Due

Beauchamp

35.00

Carley

50.00

Fairchild

50.00

Giovanelli

70.00

Morrison

100.00

Parker

105.00

Count (> 40): 5

 

Example 2

for MEMBERS with STATE = "NJ" and TOTAL DUE > 40 ;

list records

LAST NAME in order ;

TOTAL DUE ;

"A" = "A" : count .

end

 

Example 2 produces output identical to Example 1, except that Beauchamp is omitted because her TOTAL DUE is less than $40. The count statistic is again 5, but in this case it represents all the records that are processed (because all records processed satisfy the count condition).