'Declarations
Dim view As NotesView
Dim out As HTMLArea
Sub Initialize
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Set out = New HtmlArea("Hierarchy")
Set view = Web.Database.GetView("demos.hierarchy")
'Find the top-level document first (where ChildOf="". This is same as ="0" in the view)
Set vc = view.GetAllEntriesByKey("0", True)
Set entry = vc.GetFirstEntry
Call out.add("
");
While Not(entry Is Nothing)
Call out.add( {- }+ entry.Document.Title(0)+{} )
'Enter the recursive sub-routine which produces the hierarchy
Call BuildHierarchy( entry.UniversalID )
Call out.add( "
" )
Set entry = vc.GetNextentry(entry)
Wend
Call out.add("
");
End Sub
Private Sub BuildHierarchy( id As String )
Dim vc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Set vc = view.GetAllEntriesByKey(id, True)
Set entry = vc.getFirstEntry
If Not entry Is Nothing Then
Call out.add("")
While Not entry Is Nothing
Call out.add({- }+entry.Document.Title(0)+{})
Call BuildHierarchy( entry.UniversalID )
Call out.add( "
" )
Set entry = vc.GetNextEntry(entry)
Wend
Call out.add("
")
End If
End Sub