Trouble with logic around recurring document collections
Posted on 2004-11-01
I am trying to build an org chart using document collections. currently , I get the CEO of the company & the build a document collection of all the people who are under Him/Her . Then I call the function again to complie the collection under that person & so on & so on....
My problem is that I can build the structure fine for the first person under the CEO but I cannot go back up the strucure to get to the next person ...
in my sub routine , I can get the following structure :
then I am stuck cos I have lost my previous collections .... any ideas
Here is the code that I currently have :
Sub GetEmployees(ID As String)
Set EmployeeCollection = View.GetAllDocumentsByKey(ID)
If EmployeeCollection.Count = 0 Then
Print "No Underlying Employees" + " <br>"
CurrentTab = currentTab - 5
Set EmployeeDoc = employeeCollection.GetFirstDocument
While Not EmployeeDoc Is Nothing
CurrentTab = CurrentTab + 5
Print EmployeeDoc.FirstName(0) + " " + employeeDoc.LastName(0) + " <br>"
Set employeeDoc = EmployeeCollection.GetNextDocument(EmployeeDoc)