Тема: Агент АddreadersUNIK -Удалить дубли полей addreaders
Данный агент удаляет дубли значений в addreaders, если дубли есть пересохранение документа.
Option Public
Sub Initialize
' также приводит в соответствие основные поля
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As notesview
Dim curdoc As NotesDocument, maindoc As NotesDocument
Dim i As Integer, j As Integer, k As Integer
Print "START АddreadersUNIK"
On Error GoTo Errh
Set db=session.Currentdatabase
Dim collectionGSS As NotesDocumentCollection
Set collectionGSS = db.Search({((Form="incoming")|(Form="inside")|(Form="outgoing")) & (archive="1") }, Nothing , 0 )
Print "collectionGSS " collectionGSS.Count
k = 1
For x=1 To collectionGSS.count
Set curdoc = collectionGSS.GetNthDocument(x)
' Set view = db.getview("arc_incoming") ' все в архиве arc_outgoing arc_inside
' Print "view:" view.Name
' Set curdoc = view.getfirstdocument
' While Not curdoc Is Nothing
i= UBound(curdoc.addreaders)
curdoc.addreaders=ArrayUnique(curdoc.addreaders)
j=UBound(curdoc.addreaders)
If i<>j Then
Print curdoc.regnom_1(0)
call curdoc.save(0,0)
End If
k = k+1
next
' Set curdoc = view.GetNextDocument (curdoc )
' Wend
Print "обработано: " k
Print "END АddreadersUNIK"
Exit Sub
Errh:
Print Error & | in line | & Erl(), | АddreadersUNIK (| & LSI_Info(2) & |)|
Exit Sub
End Sub