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!

Using data from sub-report for calculation in main report?

Status
Not open for further replies.

JohnBurmester

Programmer
Nov 19, 2002
12
DE
Hi.

How can I use data that I have in a sub report for a calculation in the main report? Can I somehow link the data?

To be more precise: I have a subreport with a "sales revenue" in the main report I have the "costs" and I want to have the difference calculated in the main report as well. I need the subreport so trandferring the content of it into the main report would not work.

Any ideas?

Thanks for help.
John Burmester
 
You have to use shared variables. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Hi.

Thanks to Ken! However also Crystal Decision Support was very helpful and pointed me to a document that helped. I figured out the following solution (which is using shared variables.)

Use a Parameter in the sub record like this:

whileprintingrecords;
shared currencyvar x:= 0; (If you want to initialize)
shared currencyvar x:= {table.column}

and in the main report like this:

whileprintingrecords;
shared currencyvar x;
x

Make sure that the sub report is called in a section before the parameter is used! If necessary create a new section.

Greetings,
John B.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top