Examples: Documents property

This view action totals the Amount items in the selected documents in the current view.

Sub Click(Source As Button)
  Dim ws As New NotesUIWorkspace
  Dim uiview As NotesUIView
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim total As Double
  Set uiview = ws.CurrentView
  Set dc = uiview.Documents
  Set doc = dc.GetFirstDocument
  While Not (doc Is Nothing)
    If doc.HasItem ("Amount") Then
      total = total + Cdbl (doc.GetItemValue ("Amount") (0))
    End If
    Set doc = dc.GetNextDocument (doc)
  Wend
  Messagebox total,, "Total amount"
End Sub