I am having some trouble determining the correct way to go and how to implement the solution to my problem.
I am trying to use a categorized view (on the parent UNID) of associated children documents and want to be able to close the current child doc and open the next child doc with the selection being based on the parent UNID found in the categorized view.
I suspect that this script is the basis of what is required, but am unsure how to proceed.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim uiview As NotesUIView
Set db = session.CurrentDatabase
Set uiview = workspace.CurrentView
Set collection = db.AllDocuments
Set doc = collection.GetFirstDocument
Call uiview.SelectDocument(doc)
End Sub
Does anyone have any solutions for me?
Subject: Getting Next document in DocumentCollection
if you have a categorized view based categorizing child documents based on their parent UNID, you can create a document collection based on that ID.
Dim s as New NotesSession
Dim db as NotesDatabase
Dim view as NotesView
Dim collection as NotesDocumentCollection
Dim curdoc as NotesDocument
Dim parentUNID as String
'Get the parentUNID you want to process
parentUNID = ???
'Get the database and your categorized view
Set db = s.CurrentDatabase
Set view = db.GetView(“MyCategorizedView”)
'Set the collection to all documents matching the parent UNID
Set collection = view.GetAllDocumentsByKey(parentUNID,true)
'Run thru the collection if it isn’t empty
If collection.Count > 0 then
Set curdoc = collection.GetFirstDocument
Do while Not(curdoc is Nothing)
' Here you process the document
'Get the next document before continuing the loop
Set curdoc = collection.GetNextDocument(curdoc)
Loop
End If
Subject: RE: Getting Next document in DocumentCollection
I thank you for your help, and apologize for my continued problems. This is what I have on a button in the action bar of the child doc. I cannot find the correct solution 
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim collection As NotesDocumentCollection
Dim curdoc As NotesDocument
Dim parentUNID As String
'Get the parentUNID you want to process
parentUNID = "MainID"
'Get the database and your categorized view
Set db = s.CurrentDatabase
Set view = db.GetView("LineItem")
'Set the collection to all documents matching the parent UNID
Set collection = view.GetAllDocumentsByKey(parentUNID,True)
'Run thru the collection if it isn’t empty
If collection.Count > 0 Then
Set curdoc = collection.GetFirstDocument
Do While Not(curdoc Is Nothing)
’ Here you process the document
'Get the next document before continuing the loop
Set curdoc = collection.GetNextDocument(curdoc)
Call ws.EditDocument( True, curdoc)
Loop
End If
End Sub