Look for Duplicate Entries in a View and Delete the Extra

Author: Tripp W Black

Created: 11/11/1999 at 12:54 PM

 

Category:
Notes Developer Tips
LotusScript, Views

look for my "key" field and delete

Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Dim coll As notesdocumentcollection
Dim scoll As notesdocumentcollection
Dim view As notesview
Dim doc As notesdocument
Dim olddoc As notesdocument'
Dim LocNum As String
Dim counter As Integer

Set db = session.currentdatabase
Set coll = db.unprocesseddocuments
Set doc = coll.getfirstdocument
Do While Not (doc Is Nothing)
key = doc.locationnumber(0)

LocNum = key
Set scoll = db.unprocessedftsearch(LocNum,0)
If scoll.count > 1 Then

End If
doc.PutInFolder("NonUniqueDocs")
Set doc = scoll.GetNextDocument(doc)

Set olddoc = doc
Set doc = coll.getnextdocument(olddoc)
Delete olddoc


Loop
End Sub

previous page