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!

test for and counting duplicates

Status
Not open for further replies.

SMosley804

Technical User
Oct 15, 2007
44
0
0
US
Crystal XI
IBM DB2

I am trying to test for duplicate values and then perform a count, however when I try to summarize the formula that i created, I get an error that the field can not be summarized. The formula I created is below

sample data

ID Pax Time @duplicate
1A 23y 10:05 1
1A 23y 10:05 1
1A 23y 10:05 0

@duplicates

if next({id})={id} and
next({Pax})={Pax})and
next({Time})={Time} then 1 else 0;
 
You can sum these with a variable. Create formulas like this:

//{@accum} for the detail section:
whileprintingrecords;
numbervar dupes := dupes + {@duplicate};

Then in the report (or group) footer, use:
//{@display}:
whileprintingrecords;
numbervar dupes;

If you want the summary at a group level, add a reset formula in the group header:

//{@reset}:
whileprintingrecords;
numbervar dupes;
if not inrepeatedgroupheader then
dupes := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top