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-Reports In A Formula Field

Status
Not open for further replies.

goopit

Technical User
May 9, 2003
43
US
Hi,

When constructing a formula field, is it possible to reference fields contained in a sub-report used in the main report?

Any assistance will be most appreciated.

Thank You,

goopit
 
yes...you pass variable values between subreport and main report using "Shared Variables"

The trick is that if you update a shared variable in a main report for use in the subreport this must be done in a section before the subreport (adding a subsection in the main report is commonly done) conversely to use a shared variable that is updated in a subreport you must use it in a section after the one with the subreport

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Sure, use the shared variable to pass values back and forth, for example:

Main report

Group header formula:
whileprintingrecords;
shared numbervar SubPassedNum := 0;

Then in the details you call a subreport, and in the subreport you want to return a value to the main report:

Subreport report footer:
whileprintingrecords;
shared numbervar SubPassedNum := sum({table.field});

Then back in the main report you want to use the subreport value:

Main report

Group Footer formula:
whileprintingrecords;
shared numbervar SubPassedNum;
{maintable.somefield}-SubPassedNum

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top