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!

Help! Subreport and groups

Status
Not open for further replies.

muffntuf

MIS
Jan 7, 2003
155
US
Hi,

I am using CR10.

I have a main report that I need to grab subtotals out of subreport for. I got the Report Grand Total to come out of the subreport, but haven't been successful at bringing the subtotals up yet. The subreport is in the first group footer. This report has 7 groups with each needing a return from the subreport for the subtotal for each group in the main report. The groups of course are the same groupings.

So, if I had an area group and I want to match the total for that area to the area in the main report I did this:

In the subreport I made a subtotal for the group by inserting a subtotal.

Then I made a formula to display the subtotal:

WHILEPRINTINGRECORDS;

SHARED NUMBERVAR AREAINSINC:= Sum ({Command.INSTALL INCOME}, {Command.AREA}) and placed this in the group footer of the subreport.

In the Main report I built the formula:

WHILEPRINTINGRECORDS;

SHARED NUMBERVAR AREAINSINC;

But I don't get any results for that group subtotal in the main report. How do I solve this?
Thanks muffntuf


 
I think you should place the subreport in an innermost group section (group #7), and link the subreport on all seven groupfields. Then in your subreport, use a formula like the following in the report footer:

WHILEPRINTINGRECORDS;
SHARED NUMBERVAR AREAINSINC:= Sum ({Command.INSTALL INCOME});

In the main report, in a section below the one in which the subreport is located, e.g., in GH#7c if the sub is in GH#7b, you would then create an accumulation formula like:

whileprintingrecords;
shared numbervar areainsinc;
numbervar grp1subtot := grp1subtot + areainsinc;
numbervar grp2subtot := grp2subtot + areainsinc;
//etc.

Place reset formulas in the corresponding group headers like:

//{@resetgrp2subtot}:
whileprintingrecords;
numbervar grp2subtot := 0;

...and display formulas in the appropriate group footers, like:

whileprintingrecords;
numbervar grp2subtot;

You should also place a reset formula for the shared variable in a section below the one in which you place the accumulation formula, e.g., in GF#7, if the accumulation formula is GH#7c, or in a section before the subreport fires, e.g., GH#7a.

-LB
 
Thank you for responding,

Here's another one, I need to include a couple of expenses and they do not link back to anything in the main report, yet I need to show it, how can I do that?
 
Also can you clarify - the subreports you are suggesting to go into Group Header 7? I think that is what you mean.

Thanks!
 
It doesn't matter--group header #7 or group footer #7.

If these other expenses are coming from some other unrelated source, they could be added in an unlinked subreport placed wherever you like.

-LB
 
I don't think you can link on groups, you did mean the fields themselves, correct?

Thanks for you assistance. Although I don't have it running yet, I am working on it.
 
As I said, you would link on the group fields--whatever fields you are grouping on (not the groupname). You do not need to create these groups in the subreport itself.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top