Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable in report designer
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00530599
Message ID:
00531180
Views:
14
>Hi,
> I would like ot count the number of group for my report result to indicate how many user match the condition using report variable. What should I do? I have read HELP, but, I cant understand it.
>
>Thank you


You can count the number of groups in one of two ways ... neither of which is straight forward.

The first way is to use two different report variables. The first variable, nLines, should be initialized to 0, value should be set to 1 and you should select the COUNT option in the calculate section. You should set the reset option to match your group. This variable will now count how many lines are in each group. You don't really care about the total, but you do want to know when you hit the first record in each group.

Your second variable, nGroups, should be initialized to 0 and have the following expression for the value: IIF(nLines=1, 1, 0). Also set this variable to COUNT and have it reset at the end of the report. When the report is done, it should contain the total number of groups on the report.

The second method for pulling this off doesn't use report variables. Instead, create your own variable before calling the report and create a UDF that you can call from the report.
nGroups = 0
REPORT FORM xyz PREVIEW

FUNCTION IncCount
nGroups = nGroups + 1
RETURN ''
Then, in the On Entry section of the Group Header, call this UDF. If you are using FoxPro 2.x, there isn't an On Entry section. Therefore, what you can do is add a new field in the Group Header and call the UDF in the expression of that field.

Hope this helps,
Cathy
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Reply
Map
View

Click here to load this message in the networking platform