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!

Passing subreport variables to the main report.

Status
Not open for further replies.

staceyn

Technical User
Nov 19, 2004
107
US
Hello,
I am using v10 of crystal. I have a main report with several subreports. The subreports have the details suppressed and are showing the group totals only. There are grand totals calculated but the fields are suppressed.
I am trying to pass the grand total values from each of the subreports into the main report. The subreports are placed in the group footer section of the main report.
The shared variable for the grand totals is placed in the report footer section of the main report.
This is my subreport formula for the variable:

whileprintingrecords;
shared numbervar d1ly:=Sum ({@day1_price_ly})

This is my formula in the main report:

whileprintingrecords;
shared numbervar d1ly;
d1ly:=d1ly

The problem is I am only getting value of the last value in the group instead of the value from the whole subreport.

Can anyone assist as to what I am doing wrong?

Thanks,
Stacey
 
How have you linked the subreport to the main report? Make sure you are linking only by the group in which the subreport is located and any higher level groups.

-LB
 
Your shared variable is getting reset with each group footer.

In the report header place this

Code:
WhilePrintingRecords;
shared numbervar totd1ly := 0;

Insert another group footer section under the subreport and move your formula from the report footer to the new group footer section with the following changes

Code:
WhilePrintingRecords
Shared numbervar D1ly;
shared numbervar totD1ly;

totD1ly := totD1ly + d1ly;

In the report footer, create the following formula

Code:
WhilePrintingRecords;
Shared numbervar totd1ly;

totD1ly

Cheers,
-LW

 
Thanks LW that seemed to do the trick. I appreciate all of the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top