Sub Initialize
Dim NS As New NotesSession
Dim NDC As NotesDocumentCollection
Dim NDC_Parent As NotesDocumentCollection
Dim NUIWS As New NotesUIWorkspace
Dim ND_Parent As NotesDocument
Dim ND As NotesDocument
Dim Views As Variant
Dim NamesV() As String
Dim View As NotesView
Set Db=Ns.CurrentDatabase
Set NDC = Db.UnprocessedDocuments
If NDC Is Nothing Then
Print "Необходимо выделить документы!!!"
Exit Sub
Else
If NDC.Count = 0 Then
Print "Необходимо выделить документы!!!"
Exit Sub
End If
End If
'Выбор вьюхи из которой удобно выбирать документ, который будет родительским
Views = Db.Views
Redim NamesV(0)
For i% = 0 To Ubound(Views)
Set View = Views(i%)
If i% = 0 Then
Redim NamesV(0)
NamesV(0) = View.Name
Else
Redim Preserve NamesV(Ubound(NamesV)+1)
NamesV(Ubound(NamesV)) = View.Name
End If
Next
ResultNames = Evaluate({@Sort("} + Implode(NamesV, {":"}) + {"; [ASCENDING])})
NameV$ = NUIWS.Prompt(PROMPT_OKCANCELLIST, "Выбор вида...", "Выберите вид из которого будет выбираться родительский документ:", "", ResultNames)
If NameV$="" Then Exit Sub
'Выбор родительского документа
Set NDC_Parent = NUIWS.PickListCollection(3, False, Db.Server, Db.FilePath, NameV$, "Выбор родительского документа...", "Выберите один документ")
Set ND_Parent = NDC_Parent.GetFirstDocument
For i% = 1 To NDC.Count
Set ND = NDC.GetNthDocument(i%)
Call ND.MakeResponse(ND_Parent)
Call ND.Save( True, True )
Next
End Sub