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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing SubTotal Values from a Subreport

Status
Not open for further replies.

Nassy

Programmer
Mar 27, 2003
121
GB
Hi

I have created an Employee Report which has is grouped monthly by Employee Start Date. Within each group I have placed a subreport which lists employees that started before the Start Date in the group header.

So I might have:


March 2003
S Turner
J Peterson
K Bennet


Where the employees are all employees who started before March 2003.

The problem is that in my subreport I have placed a SubTotal which counts the number of employees. When I compile my Main Report I get the number of employees in each group ie in the above case the count is 3.

The Problem:

The Count Summary was created in my Subreport design but I would like to have access to it in the report. I created a formula using a Shared Variable as follows in my subreport.

Whileprintingrecords;
Shared numbervar x;
x=count({EmployeeName})

If I put this formula in my subreport design alongside the original summary field I created with the expert I can see that I get the correct subtotal figure in the subreport from this formula.

But if I try to use this subtotal outside my subreport ie in the Group Header, Group Footer, Page Header etc of the main report I run into trouble and the subtotal prints out as a grandtotal instead.

So how do I actually retrieve a subtotal from a subreport that I can actually use in the main report? If possible, I would like to do a graph using the subtotal figures.

I asked a few other questions today on this board and have since made progress but am really pulling my hair out over this one![ponder]

Nassy


 
The only thing i would say is reset the shared variable to 0 in the subreport;
@resetVar
shared numberVar x;
x = 0

toss that formula somewhere near the top of the subreport

mike
 
Store your subtotals in a shared array

The shared vales are only seen in the main report when control is returned to the main report.

Estimate the number of subtotals you will encounter then add 50% to that total....store these values in an array for use when you return to the main report.

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top