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

Sum running total fields 1

Status
Not open for further replies.

davidsturner

Technical User
Jan 14, 2015
2
US
Hello all,
I'm new to this forum but i have heard great things about it so i hope i have come to the right place. I have a subreport i am writing where i need to get the sum of 4 distinct running total fields. After i get that sum, i need to share that sum with the main report data. What is the easiest way to accomplish these two tasks?

Thanks!
 
Create the following formula and place it in the Report Footer of the Sub Report (it can be suppressed in need):

Code:
WhilePrintingRecords;
Shared NumberVar SumRT := {#RT1} + {#RT2} + {#RT3} + {#RT4}
(NB: replace the Running Totals in the formula [{#RT1}, {#RT2}, {#RT3} and {#RT4}] with the actual RT names from your report)

Then create the following formula in the main report and place it in a section after the one where the Sub Report has been placed (in need, split the section where the sub report is located into two parts with the sub report in the first and the formula in the second):

Code:
WhilePrintingRecords;
Shared NumberVar SumRT

The total of the 4 RTs from the sub report will then be available to other formulas in the main report by either referencing the formula name (whatever you called the formula in the main report) or by referencing the variable (SumRT). If referencing the variable in other formulas you will first need to initialise the variable in each formula.

Hope this helps.

Cheers
Pete


 
thanks! That got my data on my main report.

I have been informed today that i need to have 2 sub reports in this particular report so i followed the steps above and i have 2 totals on my report (one from each sub report) i need to filter the entire report to only show me data if the sum of these two counts is greater than zero. I have tried to write this formula in the group header but it is ignoring the formula i created. Any suggestions?
 
If you need to base the data in the main report on the outcome of queries in the two sub reports the only option will be to suppress the records you don't want to see.

It may be possible to achieve the outcome you need without sub reports but it is impossible to be certain without a lot more information.

Cheers
Pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top