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

Calculating from field in main report and subreport

Status
Not open for further replies.

lthomas6

MIS
Aug 22, 2007
87
US
I am using Crystal 10, SQL backend.

I have created a report with 1 subreport. The main report has a field caled Parent Matter Budget Amount . There is a field called Total Matter Cost in the subreport (it is the calculation of the subtotals in this report). I need to subtract the Total Matter cost from the Parent Matter Budget Amount to derive the Variance amount. How is this achieved?
 
In the subreport, you have to set up the value that you want to work with in the main report as a shared variable:

whileprintingrecords;
shared numbervar tmc := {@yoursubcalc};

Then in the main report, in a section below the one containing the subreport, you can reference the variable and do a calculation:

whileprintingrecords;
shared numbervar tmc;
{@yourmainamt} - tmc

You should also set up a reset formula in a section following this or in a section before the subreport executes:

whileprintingrecords;
shared numbervar tmc := 0;

-LB
 
Thank you so much!

I do have one question. When you say setup the reset formula, where is this formula to be setup in? (subreport or main report? )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top