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

Count the two "grandtotalls" from two subreports 1

Status
Not open for further replies.

OLTU

Technical User
Feb 14, 2005
39
NL
Hi all,

I've two subreports which each report have a grandtotall
but I want also count these two grandtotalls from the subreports together.

can someone pls help me on this?

Thanks,MHP
 
Pass it back to the main report, using a shared variable. Something like
whileprintingrecords;
shared currencyvar WasSaved;
WasSaved:={#TotSaved};
WasSaved

To access it in the main report, create another formula field with
whileprintingrecords;
shared currencyvar WasSaved;
WasSaved

Note that the shared variable is only available in the section after the section which contains the subreport.

Do this for each subreport, and then add the main-report values.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
In the subreport your shared variable formula should look something like:

whileprintingrecords;
shared numbervar subrpttot := sum({table.amt});

This MUST be placed on the subreport canvas. Then in the main report, in a section below the one in which the subreport is executing, add a formula:

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

Then in the report footer, use a formula:

whileprintingrecords;
numbervar grtot;

If any subreports return a null, you should also add a reset formula to the main report:

whileprintingrecords;
shared numbervar subrpttot := 0;

Place this in a section before the subreport executes or after the main report section containing the shared variable accumulation formula.

-LB
 
hi Madawc,

it's still not working to count the totall subrpt, I made for my each subrpt the below

whileprintingrecords;
shared currencyvar WasSaved;
WasSaved:={#TotSaved};
WasSaved
this step for each subrpt is working, I get the results which I want but when I'm trying in the main report
to make a formula with below,

whileprintingrecords;
shared currencyvar WasSaved;
WasSaved
my result is showing "0"
for grndttot.

pls help me to solve this irregular problem.[sad] or :-(

thanks,MHP
 
Please try my solution. You have to take the extra step of accumulating the returned subreport values in a variable in the main report.

-LB
 
yes..., it works!many thanks for your help(both).
however I can't now get these formulas in my group header or to the page header.I got null for my results when I put these formulas in headers, also I tried to create a formula and even this does not help( of course I'm not sure if my formula is correct in header.

do you have an any idea why this is happening or a solution
to how I can get these results on my header??
 
The results will only be available in report sections below the one in which you have placed the formula which accumulates the subreport totals (and this formula must be in a section below the one in which the subreports are executed). So, to use the result in a page header, the subreports, the accumulating formula and the display formula would have to be calculated in report header sections. You could do this by adding the subreports again in the report header if they are currently located elsewhere. However, this would also depend on whether these are linked subrports.

Please tell us your report structure (identify groups) and what sections the subreports are located in. We also need to know whether these subreports are linked to the main report and on what field. Finally, you need to tell us where you want the results to appear--you mention both a group header section and a page header section--which is it?

-LB
 
HI LB,

FORGET THIS.IT'S VERY DIFFICULT REPORT TO ME TO IDENTIFY THIS ON PAPER,THE REPORT IS WORKING,OF COURSE, IT WILL BE BETTER AND NICE
IF I HAD THE RESULTS OF MY FORMULAS IN THE HEADER OF THE REPORT.

I HAVE ONE SUBREPORT WHICH I WAS TRYING TO GET THE FORMULA RESULTS ON THE HEADER OF MY MAIN REPORT,BUT I SEE THIS WILL NOT WORKING FOR ME.

THANKS FOR ALL YOUR SUPPORT ON THIS.

RGDS,MHP.
 
I have a report where two subreports are in the report footer. Can a total of the main report total and the subreport totals be computed and displayed in the report? Thanks.
 
Sure, using shared variables, but you have to return the values from the subreport AFTER the sections that the subreports are in.

Try a new post as this is a closed issue and long since dead.

-k
 
Thanks for the help, synapsevampire. I don't think that there are any sections after the report footer though, right?! Thanks.
 
Insert a report footer_b section. Your subreports should be in report footer_a and your formula using the shared variables for calculation should be in report footer_b.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top