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

2 Subreports in Main Report - Need to do calculation 1

Status
Not open for further replies.

rhoneyfi

MIS
Apr 8, 2002
200
US
Hello,
I am using CR 9.0. I have a main report that contains 2 subreport. Subreport1 shows me the total number of applications a client has given to us in the past 30 days. Subreport2 shows the total number of applications a client has given us in the past 60 days. In a nutshell, what I need to do is to subtract subreport2 from subreport1 and have the result in the main report. Where do I start? Thanks
 
Where are the subreports located in the main report? Hopefully in the group footer.

In the group header, creater a formula to initialize the shared variable

Code:
shared numbervar tot1 := 0;
shared numbervar tot2 := 0

In each of the subreports, create a formula, similar to the following, using a shared variable in the same section where your totals are located.

Code:
//In subreport 1
whileprintingrecords;
shared numbervar tot1 := {Subreport1Total}

Code:
//In subreport 2
whileprintingrecords;
shared numbervar tot2 := {Subreport2Total}

From the main report, insert a section below the section containing the subreports and place the following formula

Code:
shared numbervar tot1;
shared numbervar tot2;

tot2 - tot1

Cheers,
-LW


 
kskid,
This works perfectly..Thanks! You post was very easy to follow and understand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top