Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to count the number of groups in a report?
Message
De
13/06/1996 11:32:44
Paul Wei
Fib, State of Michigan
Lansing, Michigan, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00002172
Message ID:
00002272
Vues:
44
>I have a report that has one grouping data, say
>myGroup_id. It is fairly simple to define a report
>variable to count the number of records for each
>different value of myGroup_id.
>
>But, How do you define a variable that counts the
>number of distinct values myGroup_id takes at the
>end of the report?
>
>Thanks in advance,


Make a new report variable "grp_cnt" and set the following in the "Report Variables" dialog box:

initial value = 0
reset on myGroup_id change
make it a "Count" variable

This variable now will automatically be incremented by 1 within your group and be reset to 0 when the grouping variable changes.

In the report summary area, create a field whos expression is "iif(grp_cnt=1,1,0)" and make it a "Sum" calculation.

This field sums the expression "iif(grp_cnt=1,1,0)" for each record processed but since grp_cnt is a counter that's being reset for each group, it equals 1 only once per group.

So when you sum the expression, the result equals to the number of groups you have.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform