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

Sub-Report Question 1

Status
Not open for further replies.

itsgenekramer

Technical User
Aug 21, 2003
122
US
If I have a report with an embedded sub-report, is it possible to take a data field from the sub-report and insert it into the main report?

Thank you.
Gene
 
You can "share" the subreport field with the main report by setting it up as a shared variable. In the subreport, create a formula {@sharedvar}:

whileprintingrecords;
shared numbervar amt := {subreport.field};

You must place this formula somewhere on your subreport canvas. Then in the main report, you can reference this field and do calculations with it, as in the following which sums the subreport amount in the main report:

whileprintingrecords;
shared numbervar amt;
numbervar grtot := grtot + amt;

The shared variable must be used in a section of the main report lower than the one in which the subreport is located.

To display the grand total of the shared variable, you would use a formula like the following in the main report footer:

whileprintingrecords;
numbervar grtot;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top