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!

DistinctCount in selection

Status
Not open for further replies.

FionaCondon

IS-IT--Management
Jan 6, 2003
16
GB
I want to report on everyone who has had more than one address. I created a formula, CountAddresses as

DistinctCount ({tblPUPIL_ADDRESS.tblADDRESS},{tblPERSON.PER_ID})

which seems to work. I have got the report grouped by PER_ID. When I put

{@CountAddresses}>1

in the group selection I get the message 'This formula cannot be used because it must be evaluated later'. I can sort of get round it by conditionally suppressing the details and group head when {@CountAddresses}<2 but I want to include a crosstab and that includes the suppressed records.

Can anyone help?

Fiona
 
Not sure why you're using a formula, or why it's giving that error in this case, it might be Crystal version specific, which should always be included with posts if you want specific help, but try:

Group by per_id

Report->Edit Selection Formula->Group

DistinctCount ({tblPUPIL_ADDRESS.tblADDRESS},{tblPERSON.PER_ID}) > 1

I can't recall using a distinctcount, maybe that ticks Crystal off for some reason, but your formula isn't required and just adds in a layer of complexity to Crystal's already iffy ability to process record selections.

-k
 
SV's solution should work fine. I think the issue is that you have created an extra layer by using a formula within a formula--I have found that sometimes where a formula doesn't work, rewriting it using the constituent parts of the formula will.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top