Information générale
Catégorie:
Gestionnaire de rapports & Rapports
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement