Show 

Home > DQL Guide > DQL Lexicon > count of

image\Dql_0023.gifcount of

Type

Relational Statistical Operator

Purpose

The count of operator counts how many records in a related table match the specified selection criteria. The result can appear as a list item in the detail area of a report or as a statistic in the summary area at the end of a report.

There's an important difference between the conditional statistical operator count and the relational statistical operator count of. count finds the number of records that satisfy a specified condition among the records being processed. count of calculates the number of matching records related to the records being processed by the script.

Syntax

count of TABLENAME|RELATIONSHIP

 [named "UNIQUE RELATIONSHIP NAME" ]

 [with ( selection criteria) ] ;|.

 

Example

for MEMBERS with STATE = "CA" ;

list records

LASTNAME in order ;

TOTAL DUE ;

TOTAL DUE > 100 : item count ;

count of RESERVATIONS with ( TOTAL DUE > 1500) .

end

 

This script tells DataEase: (1) Process all the MEMBERS records of members living in California, (2) list the LAST NAME and TOTAL DUE field from each MEMBERS record, (3) for each member, display a YES or NO answer indicating if the member's TOTAL DUE is greater than $100, (4) count the total number of members whose TOTAL DUE is greater than $100 and display this total as a statistic at the end of the report output (this is generated by the count operator), and (5) count the number of related RESERVATIONS records that have a TOTAL DUE greater than $1500, and display this number as a list item for each member (this is generated by the count of operator).