How to know if selectduplicates actually found any duplicates


#1

In a database with some 4 million records and lots of fields, I look for duplicate values with the selectduplicates statement and then want to determine whether any duplicates were found. I could unpropagate, look for empty values and then `propagate’ (if empties were found). Is there a better way?


#2

I don’t have time to try this myself, but have you tried

if info("empty")

It should be true if it did not find any duplicates, and false if it did.


#3

Sadly, no. I get a false result whether there are duplicates or not.


#4

I’ve not been typically using such large tables but my method is usually to have a ‘junkNum’ field.

I would first do a GroupUp on the potential duplicate field, then a Sequence in the ‘junkNum’ field. I then do a Find ≥ 2 in that ‘junkNum’ field to find each dupicate.


#5

I suspect that would take longer than unpropagate and `propagate’ and it’s a lot messier.

The other thought that occurs to me is that if, after the selectduplicates, the number of visible records is less than the total number, then certainly duplicates have been found. This test fails of course if every record has a duplicate.


#6

I just verified that David is correct. First I looked in the source code, and saw that the code is there. Then I ran tests, and info(“empty”) does in fact work correctly after selectduplicates.

That is not the results I got – it worked for me.


#7

True - I had done a quick test without noticing that not all records had been selected - some hidden ones made duplicates.

Thanks Dave for a very efficient test.