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

Can't Sum Sub-Report Total In Main Report 3

Status
Not open for further replies.

Mav3000

Technical User
Jun 20, 2005
113
GB
Hi All,

I have a CR10 Report which shows the amount of surveys and site starts per month, for two contracts. It has the following format:

GH1: Grouped by 'Month'

GH2: Grouped by 'Contract'

Details (contains sub reports)

Details contains a Subreport which lists 'Survey_Dates' and a seperate subreprot for 'Site_Start_Date'.

*Sub-Reports have been used because not every Site has a Survey Date. Having Details A and Details B would have duplicated the Site Record where a Site had both a Survey_Date and a Site_Start_Date.*

I have two variable fields that pass to the main report the total amount of Site Records that are listed in the Sub Report. This works fine and is displayed in GF2, and shows the number of sites in the SubReport for that Contract.

The problem:

I need to sum this formula total for each GF2 into GF1, however trying to put a Summary Field onto this is not allowed for some reason.

I need to show the Site Count for each SubReport total for both Contracts (GF2s) for each Month (GF1).

How can this be done?

Thanks,

Richard
 
Create these formulas:

//{@reset} to be placed in GH1:
whileprintingrecords;
numbervar sumsites := 0;

//{@accum} to be placed in GF2:
whileprintingrecords;
shared numbervar sitecnt1;
shared numbervar sitecnt2; //replace these two with your shared variables
numbervar sumsites;
sumsites := sumsites + sitecnt1 + sitecnt2;

//{@display} to be placed in GF1:
whileprintingrecords;
numbervar sumsites;

-LB
 
Thanks Lbass - I read the help about creating a running total menually with formulas and it showed the same kind of thing.

I now have the report working as it should do - thanks!
 
Is there a simple way to continue the running total for a report total?

I tried this,
//from above
//{@display} to be placed in GF1:
whileprintingrecords;
numbervar sumsites;
//adding...
numbervar sumsites2 := sumsites + sumsites2

//and then in the report footer:
whileprintingrecords;
numbervar sumsites2;

but...
the report footer is reporting that sumsites2 is the same as the last sumsites (it isn't accumulating).

any advice, outside of creating a new set of variables?


CR - 11 user
 
Use this for the display formula in the group footer:

whileprintingrecords;
numbervar sumsites;
numbervar sumsites2 := sumsites2 + sumsites;
sumsites

Then in the report footer:
whileprintingrecords;
numbervar sumsites2;

Do NOT reset sumsites2 in your group header formula.

-LB


 
thank you for this very helpful response.
The secret was the "sumsites" addition to the bottom

whileprintingrecords;
numbervar sumsites;
numbervar sumsites2 := sumsites2 + sumsites;
sumsites

CR - 11 user
 
I only put the sumsites on the "bottom" of the accumulation formula so that the current value of sumsites would be shown in the group footer, not the running total itself. The result in the report footer would be the same with or without sumsites at the "bottom" of the accumulation formula. It is just that the accumulation formula will display only the last value referenced in the formula.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top