Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Counting group headers
Message
From
06/03/2003 16:59:56
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00762349
Message ID:
00762478
Views:
13
>I have a few report forms that I need to count the number of group headings and everything that I have tried counts the number of records in the coursor. What is the best way to count the group headings?
>

Kelly,

One way to do this is it use create a variable (called nGroupCount in this example) and set it to zero before running the report, and to put _vfp.setvar("nGroupCount",nGroupCount) in the group headers on entry expression (double click on the group header's grey bar).

The downside of this method is that it does not work properly when previewing the report...the numbers get incremented too often.

Better way: Add a report variable called linesPerGroup, set it to calculate count, reset on your group in question. Add another report variable, called groupCount, set it to calculate sum, under value to store put iif(linesPerGroup = 1, 1, 0) , initial value 0, reset at end of report. If you want to put groupCount in the group header, you can put groupCount+1 in the expression to print.

If there is a way to do this reliably with only one report variable, I haven't been able to figure it out either (Garrett?)...
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform