Search for Duplicates

Hi All,

I need your help once again. I have a view called duplicates and I need to write code that bring duplicates for a field called ApplicationNumber.

For Example

ApplicationNumber First Name Last Name

1111 Paul Janes

222 Mary Smith

111 Peter Cater

The view will show the following:

ApplicationNumber First Name Last Name

1111 Paul Janes

111 Peter Cater

Could any one help with this problem?

Thanks in advance.

Subject: Search for Duplicates

This is an agent i use, it looks up a view with the first column sorted by the value you are looking for duplicates in (in my case company names) and places all duplicates into a folder named…Duplicates

hth

Sub Initialize

Dim Session As New NotesSession

Set db=Session.CurrentDatabase

Set view=db.GetView("(company)")

Dim Doc As NotesDocument

Dim LastDoc As NotesDocument



Set Doc=view.GetFirstDocument

LastCompany$=""

AllCount%=0

DupCount%=0

While Not (doc Is Nothing)

	ThisCompany$=doc.ColumnValues(0)

	AllCount%=AllCount%+1

	If ThisCompany$=LastCompany$ Then

		Call doc.PutInFolder("Duplicates")

		Call LastDoc.PutInFolder("Duplicates")

		DupCount%=DupCount%+1

		Print "Detected duplicate for "+doc.Code(0)+" - Total so far: ";DupCount%;" out of ";AllCount%

	Else

		LastCompany$=ThisCompany$

	End If

	Set LastDoc=doc

	Set doc=view.GetNextDocument(LastDoc)

Wend

Messagebox Str$(DupCount%)+" duplicates detected from"+Str$(AllCount%)+" documents and placed in the Duplicates folder.",64,"InTouch"

End Sub

Subject: RE: Search for Duplicates

Hi Mark,

Thanks for your help. This code is great .

Regards,

John