chrisryhal
asked on
Running Totals of Sub Reports
I have a main report with 2 Sub Reports. Both Sub reports have a Running Total "SUM" of a column called "Unit Price"
Is there ANY way on the MAIN report, to have a Total "SUM" of both Running Totals from teh Sub reports?
Is there ANY way on the MAIN report, to have a Total "SUM" of both Running Totals from teh Sub reports?
ASKER
//@MainSubSum1Display
whileprintingrecords;
global numbervar SUM1SUM;
appears not be 0.
//@SubSum1
whileprintingrecords;
global numbervar SUB1SUM:= {#RTotal0}
Works great on the SUB report
whileprintingrecords;
global numbervar SUM1SUM;
appears not be 0.
//@SubSum1
whileprintingrecords;
global numbervar SUB1SUM:= {#RTotal0}
Works great on the SUB report
Ok..so tell me more about the subs...so how are they linked to the main....are the subs based on GROUPING of the main?
IF you have screenshots of main showing where subs come into play..it would be great...
IF you have screenshots of main showing where subs come into play..it would be great...
You need to use SHARED rather than global.
Global variables only work on a report.
Shared allows the data to pass between the main and subreports.
In the main report header add a formula
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
Where you want to use it in the main report. It must be after the subreport
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
In the subreport
//@SubSum1
whileprintingrecords;
Shared numbervar SUB1SUM:= {#RTotal0}
//@SubSum2
whileprintingrecords;
Shared numbervar SUB2SUM:= {#RTotal0}
mlmcc
Global variables only work on a report.
Shared allows the data to pass between the main and subreports.
In the main report header add a formula
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
Where you want to use it in the main report. It must be after the subreport
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
In the subreport
//@SubSum1
whileprintingrecords;
Shared numbervar SUB1SUM:= {#RTotal0}
//@SubSum2
whileprintingrecords;
Shared numbervar SUB2SUM:= {#RTotal0}
mlmcc
ASKER
mlmcc,
Added the @SubSum's on the sub reports like so:
//@SubSum1
whileprintingrecords;
Shared numbervar SUB1SUM:= {#RTotal0}
The value DOES show on the sub reports.
Added the:
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In the main report header. Then RIGHT AFTER both Sub Reports, I added as you instructed:
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
Value displaying on the main report is "0.00"
Added the @SubSum's on the sub reports like so:
//@SubSum1
whileprintingrecords;
Shared numbervar SUB1SUM:= {#RTotal0}
The value DOES show on the sub reports.
Added the:
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In the main report header. Then RIGHT AFTER both Sub Reports, I added as you instructed:
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
Value displaying on the main report is "0.00"
ASKER
Here, I zipped it up if that helps. Change the file extension to .RPT cause EE won't accept it.
I placed RED textbox on where I did what was instructed to do.
CCI.txt
I placed RED textbox on where I did what was instructed to do.
CCI.txt
To use the values the formula in the main report must be after the subreport
The formula for the report header is simply to declare the variables for the main report
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In a later section after the subreports add the other formula whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
mlmcc
The formula for the report header is simply to declare the variables for the main report
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In a later section after the subreports add the other formula whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
SUM1SUM + SUM2SUM
mlmcc
Do the correct values appear in the subreports?
The value in the mainreport page header will be 0
mlmcc
The value in the mainreport page header will be 0
mlmcc
ASKER
Yes they appear correctly in the sub reports
In the main report you have
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In the subreports you use
whileprintingrecords;
Shared numbervar SUB1SUM;
whileprintingrecords;
Shared numbervar SUB2SUM;
They have to have the same names throughout. Change the main report to
Report header
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;
ReportFooter
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;
SUB1SUM + SUB2SUM
mlmcc
whileprintingrecords;
Shared numbervar SUM1SUM;
Shared numbervar SUM2SUM;
In the subreports you use
whileprintingrecords;
Shared numbervar SUB1SUM;
whileprintingrecords;
Shared numbervar SUB2SUM;
They have to have the same names throughout. Change the main report to
Report header
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;
ReportFooter
whileprintingrecords;
Shared numbervar SUB1SUM;
Shared numbervar SUB2SUM;
SUB1SUM + SUB2SUM
mlmcc
ASKER
still didn't work
ASKER
Actually I did get it working. Problem is that the value needs to go ABOVE the Sub Reports????
Can't be done since that part is printed before the subreports are run.
Actually you could by having the subreport in twice.
One that just gets the values you need
The other that displays later
mlmcc
Actually you could by having the subreport in twice.
One that just gets the values you need
The other that displays later
mlmcc
ASKER
mlmcc,
Thats true, I could just have it in there, but surpressed if you agre? Good idea, will try that.
Appreciate the help!!
Thats true, I could just have it in there, but surpressed if you agre? Good idea, will try that.
Appreciate the help!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think you can use the Running Subtotal if you choose it from the DataFields.
Formula IN the SUB will look like this:
//@SubSum1
whileprintingrecords;
global numbervar SUB1SUM:= [Your Running Sub-total field here] <====choose from field choices
Keep in mind GROUPING requirements...choose the GROUP instance of the subtotal.
Formula for the Main Report will look something like this:
//@MainSubSum1Display
whileprintingrecords;
global numbervar SUM1SUM;