jackdawson Posted March 8, 2008 Share Posted March 8, 2008 Hi, I have a question on subreports and the summation of the values sent by them in the master report. Structure of reports: <Master report1 - organization1> <Iteration 1> <start of subreport 1 - branch1> <start of subreport 1.1> ------- ------- --Data-- Req_Total xxxx <end of subreport 1.1> <start of subreport 1.2> ------- ------- ------- Resp_Total xxxx <end of subreport 1.2> Total from branch1 = Req_Total + Resp_Total <end of subreport 1 - branch1> <start of subreport 2 - additional data for branch1> ------- ------- ------- <end of subreport 2 - additional data for branch1> <Iteration 2> <start of subreport 1 - branch2> <start of subreport 1.1> ------- ------- ------- Req_Total xxxx <end of subreport 1.1> <start of subreport 1.2> ------- ------- --Data-- Resp_Total xxxx <end of subreport 1.2> Total from branch2 = Req_Total + Resp_Total Grand total = Total from branch1 + Total from branch2 <end of subreport 1 - branch2> <start of subreport 2 - additional data for branch2> ------- ------- ------- <end of subreport 2 - additional data for branch2> <end of master report 1 - organization1> Problem:The grand total always prints the <total from branch2> value. It doesn't add the value of <total from branch1>. What I assume is: the subreport 1.1 when returns back in the 2nd iteration the value of <total from branch1> is lost and it doesn't see it. What I don't want to do is:I don't want to move this field to master report because if I did then this value is printed after the subreport 2 which is not the requirement. Any help on this really appreciated. Thanks. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted March 9, 2008 Share Posted March 9, 2008 why don't use a second variable as accumulator, and pass it to the subreport so the subreport can use it as starting value for the grandtotal variable? In other words you would use what you have not for the subreport totals, a another set of variables (one in the master, one in the subreports) just to calculate the grand total: Master Var A = 0 Var B = 0 Subreport 1 Pass Var A as param In the subreport1 : A1 = A + total B1 = totalEnd of sunreport 1:A = A1B = B1 Subreport 2 Pass Var A as param In the subreport1 : A2 = A + total B2 = totalEnd of sunreport 1:A = A2 = total(1) + total(2)B = B2 .... A = Grand total Hope this can help Giulio Link to comment Share on other sites More sharing options...
jackdawson Posted March 11, 2008 Author Share Posted March 11, 2008 Thanks guilio. I found a way similar to what you said, there's not much difference thou. Anyways, thanks a lot for the reply. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now