Examples: GetPrevSibling method (NotesView - LotusScript®)

This script finds the second-to-last main document in the Main View of a database.

  • If the Main View is categorized and lastMain is the only main document in its category, GetPrevSibling returns Nothing, even if there are more main documents in other categories in the view.
  • If the Main View is categorized and lastMain is not the only main document in its category, GetPrevSibling returns the previous main document in the same category as lastMain.
  • If the Main View is not categorized, GetPrevSibling returns the previous main document.
Dim db As New NotesDatabase( "Addis-Ababa", "discuss.nsf" )
Dim view As NotesView
Dim lastMain As NotesDocument
Dim secondToLastMain As NotesDocument
Set view = db.GetView( "Main View" )
Set lastMain = view.GetLastDocument
' Find the last main document in the view
While lastMain.IsResponse
  Set lastMain = view.GetParentDocument( lastMain )
Wend
' Now find the second-to-last main document in the view
Set secondToLastMain = view.GetPrevSibling( lastMain )