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

Formula Double counting in Header

Status
Not open for further replies.

c8ltgkue

MIS
May 1, 2007
57
GB
Using CR XI

I have 2 tables.

Case
CourtHearing

One case could have many court hearings. The details tab contains Case.CaseId and CourtHearing.HearingDate

To avoid seeing duplicate case ID, I have grouped the data by Case.CaseID.

In the group header I have placed Case.CaseId and Minimum(CourtHearing.HearingDate, Case.CaseID) to view the first hearing date for that case.

I want to know how many cases are allocated. To do this, I have created a formula called CountCases() which has the following structure,

if {vwCaseAllocation.CaseStatus} = ‘Allocated’ then 1 else 0

I have placed this formula in header hoping the multiple caseID in details tab will not affect the CountCase formula but it does.

If I use the Previous() function in CountCase() I could avoid the double counting but Crystal won’t perform any summary on CountCase() formula.

Does anyone have any better idea ?

Many thanks in advance.

C8


 
Right-click on a Case.CaseId and choose Insert to get a choice of Running Total or Summary.

Choose Summary, do a Distinct Count. This means no distinct ID will be counted more than once.

The use of Crystal's automated totals is outlined at FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you for your response.

I do know the use of disctict count function. That's not what I was asking in my original question. Sorry for the confusion.

I thought a formula get evaluated on the basis of where it is placed. If my formula is placed in the header then it shouldn't double count.

Hope I am making sense.

Thanks
C8
 
Use grouping to avoid counting multiple cases.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You can use a running total to get the distinct count of cases that are allocated, as long as you are okay with displaying the result in the report footer. Use a formula in the evaluation section:

{vwCaseAllocation.CaseStatus} = 'Allocated'

-LB
 
Are you repeating the group header at the top of each page? If so this could be the culprit. Put the qualifier:

Not InRepeatedGroupHeader

Before your group header formula to avoid multiple evaluations of the formula per group.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top