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

Grand Totals Subreports in Main Reports 1

Status
Not open for further replies.

Garyjr123

MIS
Sep 14, 2010
139
US
Main Report set up:

sub=subreport

GH1a:mad:SchedulerName NewAppts(sub) Changed(sub) Canceled(sub)
GH1b:(suppressed) @NewAmtSum @ChangeAmtSum @CanceledAmtSum
D:(suppressed)
GF1:(suppressed)
RF: Grand Total:mad:NewGrandTotal @ChangeGrandTotal @CanceledGrandTot

Subreport formulas:

NewAppts
@NewApptAmtSum: whileprintingrecords;
shared numbervar amt := count({schedlog.appt_id});

Changed
@ChangedApptAmtSum: whileprintingrecords;
shared numbervar amt1 := count({schedlog.appt_id});

Canceled
whileprintingrecords;
shared numbervar amt2 := count({schedlog.appt_id});

Main Report Formulas:

@NewAmtSum: whileprintingrecords;
shared numbervar amt;
numbervar sumamt := sumamt + amt

@ChangedAmtSum: whileprintingrecords;
shared numbervar amt1;
numbervar sumamt1 := sumamt1 + amt1

@CanceledAmtSum: whileprintingrecords;
shared numbervar amt2;
numbervar sumamt2 := sumamt2 + amt2

@NewGrandTotal: whileprintingrecords;
numbervar sumamt;

@ChangeGrandTotal: whileprintingrecords;
numbervar sumamt1;

@CanceledGrandTot: whileprintingrecords;
numbervar sumamt2;

Now, what I want to do is get a grand total for each scheduler (NewAppts + ChangedAppts + CanceledAppts = SchedulerName total) and a grand total of the grand totals (@NewGrandTotal + @ChangeGrandTotal + @CanceledGrandTot = Report grand total). How do I accomplish this?

Gary


 
Why is there now a Group #3? Where are the subreports located now? They should in the same numbered group section as the shared variables you are referencing, although in a section above the referenced variables, e.g., the subs should be in GH2a if the shared variable references are in GH2b.

-LB
 
LB,

There is a GH3 b/c that is the structure of the subreport. We added a shared numbervar in each subreport as a reference for the main report, correct? I am merely wondering if something was wrong in the logic I created in the subreport. Sorry for the confusion.

All my subreports are in GH2b of the main report with the formula we created for the shared numbervar. The reset formula is in GH2a along with the [Group Name #2].

So again it looks like this:
GH1a 8/1/11
GH1b suppressed
GH2a Sched Name (suppressed field: reset formula sumgrp2)
GH2b Sub 1 Sub 2 Sub 3 Main Report (sumgrp2 formulas)
Sched 1 Sched 1 Sched 1
10 20 30 0
Sched 2 Sched 2 Sched 2
40 50 60 60
Sched 3 Sched 3 Sched 3
70 80 90 150


 
And what section is this:

Sched 1 Sched 1 Sched 1
10 20 30 0
Sched 2 Sched 2 Sched 2
40 50 60 60
Sched 3 Sched 3 Sched 3
70 80 90 150

-LB
 
That is an example of how the data is returned from the subreports in GH2b of the main report. All 3 subreports are in GH2b.

Gary
 
Your formulas that reference the shared variables or do calculations with them have to be in GH2c, not the same section the subs are in.

-LB
 
LB,

I put the shared variables in GF2 which seems to work better but the only problem I'm having is that now the totals are not resetting for each row. In other words I'm still getting a running total instead of a total of each line.

I have this formula in GF2:

whileprintingrecords;
numbervar sumamt6;
numbervar sumamt7;
numbervar sumamt8;
numbervar sumgrp2 := sumamt6+sumamt7+sumamt8;

But where do I put the reset formula?

whileprintingrecords;
numbervar sumgrp2 := 0;

I tried a few different spots but it none seem to reset for each scheduler.
 
Insert another GF2 section (b) and place the reset formula there.

-LB
 
I'm glad to see I'm starting to think the same way you do b/c I tried this as well and it still is doing a running total. I'm thinking that I must of screwed up one of the formulas some where.

Subreport formula:

whileprintingrecords;
shared numbervar amt6:= count({schedlog.appt_id});//Subreport 1
whileprintingrecords;
shared numbervar amt7:= count({schedlog.appt_id});//Subreport 2
whileprintingrecords;
shared numbervar amt8:= count({schedlog.appt_id});//Subreport 3

Placed in subreport GF3c (sched.appt_id) of each subreport

Main Report Formulas:

whileprintingrecords;
shared numbervar amt6;
numbervar sumamt6 := sumamt6 + amt6//GH2g

whileprintingrecords;
shared numbervar amt7;
numbervar sumamt7 := sumamt7 + amt7//GH2g

whileprintingrecords;
shared numbervar amt8;
numbervar sumamt8 := sumamt8 + amt8//GH2g

whileprintingrecords;
numbervar sumamt6;
numbervar sumamt7;
numbervar sumamt8;
numbervar sumgrp2 := sumamt6+sumamt7+sumamt8;//GF2a

whileprintingrecords;
numbervar sumgrp2 := 0;//GF2b

This is how it's set up but still giving me a running total.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top