I am receiving an error on the agent below on this line: “Dim collection As NotesDocumentCollection”. I cannot get debugger to work for some reason. I am not versed well on LS. Could someone take a look at this and provide any suggestions? Thanks!OR if there is an easier way to delete duplicate documents I am open to that as well ![]()
(The purpose of this agent is to delete duplicate documents based on a view that I created).
Option Public
Option Declare
Sub Initialize
Dim s As NotesSession
Dim selection As String
Dim collection
Dim collection As NotesDocumentCollection
Dim doc1 As NotesDocument
Dim doc2 As NotesDocument
Set db = s.CurrentDatabase
Dim view As NotesView
Dim count As Integer
Set view = db.GetView(“vPMISTask”)
Set doc1 = view.getfirstdocument
While Not (doc1 Is Nothing)
Set doc2 = view.GetNextDocument(doc1)
If Not (doc2 Is Nothing) Then
If (doc1.PMISTask(0) = doc2.PMISTask(0)) Then
'----Mark Delete document to 1------------
doc2.Mark = "1"
Call doc2.save(True,True)
End If
End If
Set doc1 = view.GetNextDocument(doc1)
Wend
'------Delete Document
Dim dateTime As New NotesDateTime( "" )
Selection = “(Form = ““FORM_NAME”” & Mark=”“1"” )"
Set collection = db.Search( Selection, dateTime, 0 )
For j = 1 To collection.Count
Set doc2 = collection.GetNthDocument( j )
Call doc2.remove(True)
Next
End Sub