Examples: AutoUpdate property

  1. This QueryRecalc event sets AutoUpdate to False so the view is not repetitively updated during processing.
    Sub Queryrecalc(Source As Notesuiview, Continue As Variant)
      Dim view As NotesView
      Dim doc As NotesDocument
      Set view = Source.View
      view.AutoUpdate = False
      Set doc = view.GetFirstDocument
      Do While Not doc Is Nothing
        Call doc.ReplaceItemValue("Categories", _
        doc.Categories(0) & "0")
        Call doc.Save(True, False)
        Set doc = view.GetNextDocument(doc)
      Loop
    End Sub
  2. This agent creates a document after getting an uncategorized view. It sets AutoUpdate to False before navigating through the view, so the new document is not processed. This is indicated by the top level entry count, which remains the same before and after processing.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Set db = session.CurrentDatabase
      Set view = db.GetView("All")
      Messagebox view.TopLevelEntryCount,, view.Name
      Dim doc As New NotesDocument(db)
      Call doc.ReplaceItemValue("Form", "Main Topic")
      Call doc.ReplaceItemValue("Subject", "New document")
      Call doc.Save(True, True)
      view.AutoUpdate = False
      Set doc = view.GetFirstDocument
      While Not(doc Is Nothing)
        Set doc = view.GetNextDocument(doc)
      Wend
      REM The entry count is the same
      REM because the view is  not automatically refreshed when
      REM GetFirstDocument or GetNextDocument accesses the
      REM new document
      Messagebox view.TopLevelEntryCount,, view.Name
    End Sub
  3. This agent creates a document after getting an uncategorized view. It leaves AutoUpdate at the default True before navigating through the view, so the new document is processed. This is indicated by the top level entry count, which is incremented after processing.

    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim view As NotesView
      Set db = session.CurrentDatabase
      Set view = db.GetView("All")
      Messagebox view.TopLevelEntryCount,, view.Name
      Dim doc As New NotesDocument(db)
      Call doc.ReplaceItemValue("Form", "Main Topic")
      Call doc.ReplaceItemValue("Subject", "New document")
      Call doc.Save(True, True)
      Set doc = view.GetFirstDocument
      While Not(doc Is Nothing)
        Set doc = view.GetNextDocument(doc)
      Wend
      REM The entry count is incremented reflecting the
      REM new document
      REM because the view is automatically refreshed when
      REM GetFirstDocument or GetNextDocument accesses the
      REM new document
      Messagebox view.TopLevelEntryCount,, view.Name
    End Sub