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

mathematical operations when one number is in a subreport 1

Status
Not open for further replies.

robreports

Technical User
Feb 10, 2010
20
US
I have two numbers displayed one directly below the other. But the lower number actually is a subreport summation value. The top number is part of the main report.Is there a way to subtract the lower subreport number from the upper number which is in the main report?No?
Currently,I whip out my calculator and perform the math manually and then just create a text box and type the number in it.I leave the text highlighted in red color so as to remind myself everytime I run this report that this one value is "stupid"/not "live" and to recalculate it and type in the new value.
The subreport exists becuse it is grouped entirely differently with different filters than that of the main report.


 
Set up the subreport calculation as a shared variable, as in:

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

Then in a section below the one containing the sub (e.g, in GFc if the sub is in GFB, use a formulas like this for the calculation:

whileprintingrecords;
shared numbervar subtot;
sum({main.subtot},{table.groupfield}) - subtot;

If the subreport subtotal can be null, you need a reset formula before the section containing the subreport.

-LB
 
Lbass, I think I must have setup my report badly because my subreport is embedded inside the main report and the main report is all suppressed except in the Report Footer section.My subreport lies in the Report Footer section of the main as well(line 4 of 5 line report).Embedded see?Now what do I do?I keep getting "0" when I refresh my report.Can I add another group section to the report to fix this predicament?From now on I will never place the subreport into the only non-sppressed section of the main report.

 
Place the sub in an RF section above the one in which you want to reference the variable-e.g., place it in RH_a and then reference the variable in any section below that. The section containing the sub and the sub itself cannot be suppressed, but you can make the sub disappear by suppressing all sections WITHIN the sub, removing the border, formatting the sub to "suppress blank subreport" on the format subreport->subreport tab, and then formatting the RHa section -> check "suppress blank section."

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top