Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count groups in report

Status
Not open for further replies.

EmmaLu

Programmer
Jul 16, 2004
38
0
0
US
I have a report that included Data Grouping. How can I print the number of groups in the report?
 
You can easily determine this value before submitting the report's table/cursor to the REPORT FORM.

Code:
SELECT DISTINCT GroupType;
  FROM MyTable;
  INTO CURSOR GroupCount

SELECT GroupCount
mnGroupCount = RECNO()
USE

SELECT MyTable
REPORT FORM Whatever ...

Good Luck,
JRB-Bldr
 
I understand how to get that count prior to running the report but I was looking for a way to do this just within the report layout using a variable or something? I tried assigning a report variable and then using the On Entry Expression of the Group Footer band, but that doesn't seem to work.
 
From Cathy Pountney's "The Visual FoxPro Report Writer: Pushing it to the Limit and Beyond":

[ol]
[li]Create a report variable e.g. nGroupCount[/li]
[li]Set the value to store to 0[/li]
[li]Set the initial value to 0[/li]
[li]Set the calculate option to SUM[/li]
[li]Set the reset option to End of Report[/li]
[li]In the Group Footer "On Entry" expression enter _VFP.SetVar("nGroupCount", nGroupCount + 1)[/li]
[/ol]

I found a sample chapter of her book here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top