Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Topic: Subreport Totals and Mainreport Totals Posted: 06 Nov 2011 at 8:07pm
I created a subreport that included a total by group. I also have total by group in the main report. How do I combine the total from the subreport to the main report total?
Joined: 03 Aug 2011
Online Status: Offline
Posts: 13
Posted: 07 Nov 2011 at 3:26am
What would the formula be if there is a subreport total and main report total but if there is 0 in the subreport total the main report total is the total by date.
Joined: 22 May 2009
Online Status: Offline
Posts: 347
Posted: 07 Nov 2011 at 7:48am
The shared variable needs to be created in both the Subreport and the main report. You will declare the value of the variable in the subreport:
whileprintingrecords; shared numbervar nTotal:=(the total by group field);
And you will display the value in the main report:
whileprintingrecords; shared numbervar nTotal;
To get the subreport to run properly for the group, you will need to devise a way to get the subreport to only run for that group date. To achieve this, I believe you will have to create another shared variable that takes the date of the group from the main report and passes it to the subreport. The subreport should then use this date in the Record Selection Formulas. This will limit the subreport to run only for the current group date.
Something to remember. The shared date variable from the main report needs to be calculated before the subreport. So you will probably need to place it in the Group Header.
Also, the Subreport needs to be run in a section before you can use the shared variable that comes from it. For this, you may need to have a Group Footer A and Group Footer B. The subreport would be put in A and the combined total would be put in B.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum