例: Count property (NotesViewNavigator - LotusScript)

次のエージェントは、ビューの総エントリ数と、各カテゴリのエントリ数を取得します。

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim nav As NotesViewNavigator
  Dim nav2 As NotesViewNavigator
  Dim entry As NotesViewEntry
  Set db = session.CurrentDatabase
  Set view = db.GetView("By category")
  view.AutoUpdate = False
 
  REM Create navigator for entire view and get count
  Set nav = view.CreateViewNav()
  Messagebox nav.Count,, "Number of entries in view"
  
  REM Get each entry that is a category
  Set entry = nav.GetFirst()
  While Not(entry Is Nothing)
    If entry.IsCategory Then
      REM Do not process uncategorized
      If Not Isempty(entry.ColumnValues) Then
        cat$ = entry.ColumnValues(0)
        REM Create navigator for category and get count
        Set nav2 = view.CreateViewNavFromCategory(cat$)
        Messagebox nav2.Count & " entries",, cat$
      End If
    End If
    Set entry = nav.GetNext(entry)
  Wend
End Sub