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

Grand Total from Subreport 4

Status
Not open for further replies.

AyJayEL

Technical User
Jan 30, 2001
425
GB
I have a report with a Student Group 1, CaseWorker Group 2. I am suppressing the whole Student Group when there is only one CaseWorker and where the CaseWorker is not in Service 2. I the group footer details B for the Student I have a subreport that brings shows all the time spent working with the student by the Caseworker. I have passed this total back to the main report. How do I sum this total to a Grand Total for the whole report? I get the message 'The summary/running total field could not be created'.

I am using Crystal 8 on an Oracle Database.

Learn something new every day
Using Crystal 8, Oracle Database
 
Set up another variable. Use it to accumulate the values from the subreport shared variable.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I created Grand Total with this formulae

whileprintingrecords;
shared numbervar GT:=GT+{@passmain};
GT

Placed it in footer. It brings back the last record.

Learn something new every day
Using Crystal 8, Oracle Database
 
Let's say that your subreport shared variable (placed in the subreport report footer) looks like the following and is called {@passmain}:

whileprintingrecords;
shared numbervar subtot := sum({table.hours});

Then in the main report, in a section below the one in which your subreport is placed (if the sub is in GF2b, place this in GF2c), add this formula:

whileprintingrecords;
shared numbervar subtot;
numbervar gt := gt + subtot; //this accumulates the subtot
subtot //add this here so that the subtot only displays in the GF2c

Then in the report footer display the result using this formula:

whileprintingrecords;
numbervar gt;

-LB
 
You may be able to simply add the shared variable to a sum formula, like this:

shared numbervar iob + Sum ({dAgentBySkillsetStat.CallsAnswered})

This is from a report where the sub report passed a shared variable (iob) back to the main report and I had to add this to a summary from the main report for a 'grand total'.

If you're adding lots of shared variables, it's very simple code, like this:


shared numbervar iob + shared numbervar pob +
shared numbervar sob + shared numbervar pibob

Keep in mind 2 things: The sub reports have to be physically on top of (higher than) the shared variables and you can supress the sub report's shared variable fields, but not the section the sub report is in.
 
Well it's sort of worked! It is now summing the amount passed from the subreport. Unfortunately it is adding in that amount for each suppressed group in the main report so I am ending up with a fantastic number at the end.

For instance say 1.5 hours is brought back for the first student and there are 6 suppressed students below it. It will add the 1.5 7 times. I have used this formula to try to get round it but it's not working...

whileprintingrecords;
shared numbervar passover;
if ({#Count EP2}<> 0 or {#Count NON EP} <> 0 )//suppression used in main report = {#Count EP2}=0 or {#Count NON EP} =0
then numbervar gt := gt + passover;



Learn something new every day
Using Crystal 8, Oracle Database
 
Make it
Code:
if ({#Count EP2}<> 0 and {#Count NON EP} <> 0


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you chaps and chappesses! All working fine.

Learn something new every day
Using Crystal 8, Oracle Database
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top