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

Incorrect Summary of Group Field

Status
Not open for further replies.

RealityCheque

Technical User
Apr 1, 2004
41
GB
I'm using V9 of Crystal and the report is relatively simple, the basic structure looks like:

Group 1 (Team)
Group 2 (Name of Employee)
Detail (Sickness record)

I'm trying to sum a formula in the Group 2 Header calculating days employed (and thus totally unrelated to the detail), to appear in the G1 footer. Annoyingly both a field summary and a manual running total keep counting the last record 4 times, throwing my summary off kilter. The MRT is 100% accurate before it gets to the group for the last employee in the team, and then gives me the same answer as the Field Summary.

To give you an example:
Emp# - Days Employed
Emp1 - 64
Emp2 - 60
Emp3 - 43
Emp4 - 65
Emp5 - 30
Emp6 - 54

Total SHOULD be 316, however comes up as 478.

Anyone recommend something for me to try? I'm going bonkers here, having been stuck on this for nearly a week now.

Simon

"I do not have to forgive my enemies. I have had them all shot."
- Ramon Maria Narvaez
 
Stating "I'm trying to sum a formula in the Group 2 Header " is far lessdescriptive then posting the actual formula.

Ayway, Ithink that you want to performaggregates against agroup level field, which is non-recurring:

To perform aggregates against a grouplevel value, use a manual formula:

whileprintingrecords;
numbervar MyGrouptotal=MyGrouptotal+<your fieldorformulaorwhatevervalues>;

Then in the report foooterdisplay using:

whileprintingrecords;
numbervar MyGrouptotal

-k
 
I didn't think the formula I'm trying to sum was an influencing factor, which is why I didn't post it. It is...

Code:
WhileReadingRecords;
Local DateTimeVar d1 := {@Q1StartDate};
Local DateTimeVar d2 := {@Q1EndDate};

DateDiff ("d", d1, d2) - 
     DateDiff ("ww", d1, d2, crSaturday) -
     DateDiff ("ww", d1, d2, crSunday)

Unfortunantly I have already tried your solution, which is what meant by Manual Running Total (sorry, all the other Crystal users I know call it that, so I assumed it was standard terminology!)

Simon

"I do not have to forgive my enemies. I have had them all shot."
- Ramon Maria Narvaez
 
They are termed manual summaries by most.

The 3formulamethid is common, but no doubt you've already tried that you just din'twant toshare it.

outer groupheader1formula:
numbervar sumtotal:=0

Yourgroupheader:
outer groupheader1formula:
numbervar sumtotal:=sumtotal + <whateveryouwant summed>

outer group footer formula (display total here):
numbervar sumtotal

-k
 
Right, I've just tried your 3 formula method - and it gives me exactly the same number as the other methods.

I'm starting to think that the formula is correct but something is going wrong elsewhere. Having tried these methods with another formula in the group, I encounter the same problem - the last record is counted 4 times.

Simon

"I do not have to forgive my enemies. I have had them all shot."
- Ramon Maria Narvaez
 
Problem solved - I hid the detail instead of supressing it, and now it all adds up.

Simon

"I do not have to forgive my enemies. I have had them all shot."
- Ramon Maria Narvaez
 
Were you using a subreport?

Right, well suppression does not alter whether formulas are evaluated, so check again for other differences.

Right, glad you worked it all out...

-k
 
Nope, no subreports. I didn't even change it to see if this would make a difference, it was completely accidental - and also the only change I made since the previous test.

Still, I'm not complaining. Thanks for your help anyway!

Simon

"I do not have to forgive my enemies. I have had them all shot."
- Ramon Maria Narvaez
 
Hmmm, I'd be curious to see this report, as I'm sure Crystal would as well, it means something is broken.

In almost every case it's user based, but regardless, if it ain't broke...

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top