Hi all,I have a requirement to lookup a hidden view that has a list of users’ names
(categorized) with a second column displaying the year (categorized) and a
third column dispplaying the number of vacation days approved and taken by user
(number of days for each request and totals for year and user) as displayed in
table hereunder. The action is listed in the action menu for users to select.
What I would like to do is take the total number of days taken by Max Keeping
(18 days) and update his profile (which uses a different form and resides in a
different view) document’s “Vacation_Taken” field and then go on to Louise
White’s total and update her profile document and so on untill all the view has
been done.
So far I have concentrated on the CreateViewNavFromCategory method to get the
totals but I am getting error message when testing the first part of the script
code which is to grab the total for the user (i.e. Max Keeping - 18 days) and
display it in a messagebox.
The error message I keep getting is : “Variant does not contain an object” on the second last line of the code where it says :
Set doc = v.GetNextDocument(doc)
Can anyone help me out on this one I am not getting
much ahead regarding the CreateViewNavFromCategory method .
Sub Initialize
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Dim doc As NotesDocument
Dim username As String
Set db = session.CurrentDatabase
Set view = db.GetView("(AllTotal)")
Set doc = view.GetFirstDocument
username = doc.name(0)
Do While Not (doc Is Nothing)
Set nav = view.CreateViewNavFromCategory(username) 'Get the name/category from the name column
Set entry = nav.GetFirst 'this should be your 1st level category (name) with totals
Messagebox username & " has " & entry.ColumnValues(2) & " days in total vacation requests for " & entry.ColumnValues(1) ,,"Total vac request days for " & entry.ColumnValues(1)
Set doc = v.GetNextDocument(doc)
Loop
End Sub
THE VIEW IS DISPLAYED WITH NAME IN 1ST COL, YEAR IN 2ND COL AND TOTALS IN 3RD COL:
Max Keeping 18
2007 18
8
5
5
Louise White 9
2007 9
5
4