How do i find duplicate documents

I have a database where I want to find all the documents that have duplicates. In this case a duplicate is defined as multiple documents that have the same CompanyName and the same Country. How can I build a view that only shows the duplicates. I can get the view along with the count but can’t see to exclude the keys with a count of 1 or even if I could sort the view by the count column.

Thanks for your help.

Subject: How do i find duplicate documents

Here is a neat little Document Compare Utility >> http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/17c785f8028e7c8785256a7000497fd9?OpenDocument&Highlight=0,DocCpare.nsf

Subject: How do i find duplicate documents

That’s right, you can’t. Documents are selected into views according to what they, themselves contain; you can’t use the content of one document to select another (except as a response).

Subject: RE: How do i find duplicate documents

Okay then - is there an easier way than building a view by the CompanyName + Country key; running an agent against all documents that checks this view and sets a field if duplciates found. Then I can make a view with selection formula based on this new field?

Thanks

Subject: RE: How do i find duplicate documents

Here’s what I did to check for dups in the NAB. This is in another database that audits the NAB.

Dim dbNAB As NotesDatabase

Dim doc1 As NotesDocument    

Dim doc2 As NotesDocument

Dim viewNAB As NotesView

Dim viewDup As NotesView

Dim vc As NotesViewEntryCollection



Dim ENum As String

Dim fullname1 As Variant

Dim fullname2 As Variant

Dim ENum1 As String

Dim ENum2 As String



'The info for NAB is set in the Profile document 

Set dbNAB = s.GetDatabase(NABServer, NABFileName)

Set viewNAB = dbNAB.GetView(NABView) 

Set viewDup = db.GetView("Duplicates")



Set doc1 = viewNAB.GetFirstDocument

Set doc2 = viewNAB.GetNextDocument(doc1)



While Not doc2 Is Nothing	

	fullname1 = Evaluate("@Name([CN]; FullName)", doc1)

	fullname2 = Evaluate("@Name([CN]; FullName)", doc2)

	eNum1 = doc1.EmployeeID(0)

	eNum2 = doc2.EmployeeID(0)

	

	If eNum1 <> ""  And enum1 <> "---"Then

		If eNum1 = enum2 Then

			Set docDup = db.CreateDocument

			docDup.Form = "Duplicates"

			docDup.EmployeeID = ENum1

			docDup.DisplayName = fullname1(0)

			docDup.DisplayName2 = fullname2(0)

			If doc2.HasItem( "$Conflict" ) Then

				docDup.Comment = "Conflict"

			End If

			If docDup.Comment(0) = "" Then

				docDup.Comment = "ENum"

			Else

				docDup.Comment = docDup.Comment(0) & " - " & "ENum"

			End If

			Call docDup.Save(True, True)

		End If

	End If		

	Set doc1= viewNAB.GetNextDocument(doc1)

	Set doc2 = viewNAB.GetNextDocument(doc1)

Wend

Subject: RE: How do i find duplicate documents

Not really, not in the sense that it would be any easier or more practical/efficient.