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

Passing values from subreport to main report 2

Status
Not open for further replies.

paljnad

Technical User
Aug 28, 2008
42
US
Hi,

I have a main report that has company code values and I have a subreport that has totals in the {GF by company code}section. I need to pass the total from the subreport to the main report based on company code.

My main report looks like this:

RH - Suppressed
PH - Report Headings
GH1.Company - Suppressed
Details - Suppressed
GF1.Company - Totals by Company
RF - Grand Total
PF - Page Number

My Sub report looks like this:

RH - Suppressed
PH - Suppressed
GH1.Company - Suppressed
GH2.Portfolio - Suppressed
Details - Suppressed
GF1.Company - Totals by Company
GF2.Portfolio - Suppressed
RF - Suppressed
PF - Suppressed

When I run my subreport, I get multiple totals by company code back in GF1 which looks like this:

Forecast:12346.67 CompanyCode: 01
Forecast:565565656.67 CompanyCode: 03
Forecast:34534534.67 CompanyCode: 05
Forecast:456546546.78 CompanyCode: 92

I need these totals in the main report which currently looks like this:

CompanyCode:01 ST Cash: 989809.87 LT Cash: 7843874.87
CompanyCode:03 ST Cash: 565469.87 LT Cash: 7456554.87
CompanyCode:05 ST Cash: 967564.87 LT Cash: 2343242.87
CompanyCode:92 ST Cash: 234324.87 LT Cash: 3453453.87

The report should eventually look like this:

CompanyCode:01 ST Cash: 989809.87 LT Cash: 7843874.87 Forecast: 12346.67

I tried creating formulas and linking them but it still wont work properly. I put the subreport in the GF1 section but it puts all the totals by all companies instead of linking by company.












 
The sub should go in GF1. Then in the main report, go to edit->subreport links and link the company codes to each other.

-LB
 
you need to declare a gloabal variable in your subreport then assign value to it in your sub and then call it your main report.

1. Go to your subreport, and create new formula filed and type:
global numbervar x; //This will declare variable
x:= {Table.Value} // assigns value to your variable


then go to your main report and create new formula field, inside the field type
global numbervar x; // Declares shared variable
x // Prints whatever is value is assigned to it.



 
If the OP needed to share variables, the variables would have to be shared, not global, but I didn't see anything (yet) to indicate the need for them.

-LB
 
he wants it from sub to mail, link works the other way from main to sub.

Did I read it incorrectly :)
 
As far as I can tell, the OP only wants to display the content of the sub (the forecast result) in the main report, so a link would be sufficient for that. The link acts like a left outer join to the subreport.

-LB
 
Thank you both for your responses.

I used a link and was able to get the data that I wanted.

I used a couple of formulas and variables in the main report to display the total by all company codes from the subreport. I put it in the group footer of the main report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top