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

Calculations between subreport and primary report

Status
Not open for further replies.

dbeebe

Programmer
Apr 30, 2008
2
0
0
US
The platform I'm using is Crystal 10. The business requirement is to build a report that has two date input parameters: 1) for current data (generally YTD), and 2) for baseline data (generally previous year).

The first part of the requirement is met by building two separate crystal reports and linking the subreport to the main report.

The second part of the requirement is to perform calculations on the actual vs baseline data. I'm stumped and can't think of a logical way to calculate on two separate sets of data.

Thanks for your help.
 
You can use Shared Variables to pass data back from a subreport. E.g.
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved:={#TotSaved};
SumSaved
And to access it in the main report, create another formula field with
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved

Note that the shared variable is only available in the section after the section which contains the subreport.

You could also use Edit > Subreport Links to pass the main-report value to the subreport and do the totalling there.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
THANK YOU! This is just what I needed!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top