Example: Accessing view entry properties

  1. This example will display several NotesViewEntry properties.
Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim view As NotesView
  Dim entry As NotesViewEntry
  Dim pv As NotesView
  Dim doc As NotesDocument
  Set db = session.CurrentDatabase
  Set view = db.GetView("By Category")
  Set entry = view.GetEntryByKey("Cars")
  Set pv = entry.parent
  Set doc = entry.Document
  Messagebox "Children: " & entry.ChildCount & Chr(10) _
  & "Descendants: " & entry.DescendantCount & Chr(10) _ 
  & "FTSearch score: " & entry.FTSearchScore & Chr(10) _ 
  & "Indent level: " & entry.IndentLevel & Chr(10) _ 
  & "Note ID: " & entry.NoteID & Chr(10) _ 
  & "Parent view UNID: " & pv.UniversalID & Chr(10) _ 
  & "Siblings: " & entry.SiblingCount & Chr(10) _ 
  & "Universal ID: " & entry.UniversalID
  
  If entry.IsCategory Then
    Messagebox "This view entry is a category."
  Else
    Messagebox "This view entry is not a category."
  End If
  If entry.IsConflict Then
    Messagebox "This view entry is a conflict document."
  Else
    Messagebox "Not a conflict document."
  End If
  If entry.IsDocument Then
    Messagebox "This view entry is a document."
  Else
    Messagebox "This view entry is not a document."
  End If
  If entry.IsTotal Then
    Messagebox "This view entry is a total."
  Else
    Messagebox "This view entry is not a total."
  End If
  If entry.IsValid Then
    Messagebox "This view entry is valid."
  Else
    Messagebox "This view entry is not valid."
  End If
End Sub
  1. The following script is an agent that scans the current database for conflict entries and sends a mail message if any exist.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim entry As NotesViewEntry
    Set db = session.CurrentDatabase
    Dim Vec As  notesViewEntryCollection 
    conflictCount = 0
    Set view = db.GetView( "($All)" )
    Set vec = view.AllEntries
    Set entry = vec.GetFirstEntry()
    Set doc = entry.Document
    If session.IsOnServer Then
       serverName = db.Server
    Else
       serverName = "local"
    End If
    While Not (doc Is Nothing)
       If entry.IsConflict Then
          conflictCount = conflictCount + 1
       End If
       Set entry = vec.GetNextEntry(entry)
       If entry Is Nothing Then
          If conflictCount > 0 Then
             temp = "Count Rep Conflicts Agent detected " _
             & conflictCount & " conflicts in database " _
             & db.title & " on "  & serverName
             Set doc = New NotesDocument( db )
             doc.Subject = "Replication conflict alert message"
             doc.Body = temp
             Call doc.Send( False, "John Smith" )
          End If
          Exit Sub
       End If
       Set doc = entry.Document
    Wend