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

Passing data from subreport to main report for formula 1

Status
Not open for further replies.

travelerII

Technical User
Jun 4, 2009
66
US
I have created a report that shows Inventory on hand, Safety Stock required, product being built, product to be sold and average monthly usage. I had to use subreports to get the inventory on hand and the average montly usage. All the data are in the details section. I then group on the product and sum the data into the group header section. I have placed the subreports in the group header This all works great but now I need to write a formula that looks at the data and lets us know how much to build in the next month, etc.
The data from the subreports is not available to use in formulas in the main report. I have searched threads regarding shared variables and have tried to copy them but they don't seem to work. I am using Crystal 10 and have put the following formula in the subreport for average monthly usage.
whileprintingrecords;
shared numbervar AvgMonthlyUsage := {@Avg Monthly Usage}
when I place it in the subreport it returns the correct number.
I placed the following formula in the main report.
whileprintingrecords;
shared numbervar AvgMonthlyUsage;
I then moved the subreport up into the page header and placed the shared variable formula for average monthly usage in the group header but all I get is 0.00 on all lines instead of the average monthly usage.
Any help is greatly appreciated.
 
I would put the sub in a group header_a section, and then reference the variable in group header_b. Nothing wrong with your formulas, but I'm guessing you either suppressed the subreport or suppressed the section containing the subreport. You cannot do either and still pass a shared variable.

You can make the new group header_a section disappear by suppressing all sections within the subreport, formatting the subreport->format subreport->subreport tab->check "suppress blank subreport", and then remove the borders from the sub. Then go into the section expert->group header_a->check "suppress blank section".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top