>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