Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count in footer band incorrect
Message
 
To
25/11/2002 14:35:24
Terrence Spencer
Municipal Advisory Council of Texas
Austin, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00726607
Message ID:
00726612
Views:
11
The COUNT function is meant to count the number of detail records .. that's it. It's not meant to count the number of data groups. However ... here's a trick you can pull to make it happen:

Create a report variable ... set it to SUM instead of count ... set the value to store to 0 ... set the reset to End of report. This will tell it to SUM nothing .. but that's okay.

Now .. in the Data Group Footer, enter the following in the "On Exit" expression:

_VFP.SetVar('rnYourVariable', rnYourVariable + 1)

This forces the variable to get incremented at the end of the data group, yet the native SUM you set up doesn't destroy the variable because all you've told it to do is add 0 to itself.

Cathy






>I have a report that is fed by this sql.
>
>SELE C.NAME,;
>B.ADDRESS, B.CITY,;
>P.FNAME,P.LNAME;
>FROM COMPANY C JOIN BRANCH B;
>ON C.ID = B.PARENTID
>JOIN PEOPLE P;
>ON B.ID = P.PARENTID
>
>So I have multiple companies, that have multiple branches, that have multiple people.
>
>I have 2 data grouping bands, one on CompanyID, and one on BranchID
>
>In the footer of the CompanyID band I am trying to count the number of branches in the company. I am putting a field "branchID" and calculting "Count", resed on CompanyID.
>
>This count is giving me a count of the detail band, ie # of people in the company, instead of branches in the company.
>
>In the report summary band I am putting a count of CompanyID, reset end of report, but it too is giving me a count of the detail band for the entire report.
>
>Any Ideas on what switch I am missing?
>
>Thanks,
>Terrence
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
Next
Reply
Map
View

Click here to load this message in the networking platform