Is there a way to capture column totals in a document using LS or formula.
Here is what I have in LS and it is giving me the value of the first document in the view and not the total.
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim username As String
Set db = session.CurrentDatabase
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Set view = db.GetView(“AllTotal”)
username = doc.name(0)
Set entry = view.GetEntryByKey(username, False)
Messagebox entry.ColumnValues(1),“Column 1”
Then I tried to put a computed field in the document with the following formula:
tmp := @DbLookup(“”; “”; “AllTotal”; Name; 2); 0;
@Sum(tmp)
And again I am getting not the sum but the first value of the first doc.
Is this possible to do? I am trying to write a validation to check to make sure the number requested is not over the number available.
Any suggestions would be great. Thanks,
Subject: Column Totals
If you are trying to grab the category line’s total value directly from the view, you need to create a NotesViewNavigator and work through that. Other methods only give you the document entries, not the totals and categories. You should be able to get the category totals from any line where IsCategory is True, and the grand total from the last line (where IsTotal will be true).
Subject: RE: Column Totals
Thanks Stan for your direction. I have spent all day reviewing NotesViewNavigator and I am a bit confused. My view has the first column as a sorted and categorized which I need to match up with first. The next column is where I need to grab the total from. I am confused as to how I can get the totals from the second column. So far I have this:
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim view As NotesView
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Dim entryB As NotesViewEntry
Dim doc As NotesDocument
Dim username As String
Set db = session.CurrentDatabase
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Set view = db.GetView(“AllTotal”)
username = doc.name(0)
Set nav = view.CreateViewNav()
Set entry = view.GetEntryByKey(username, False)
Set entryB = nav.GetFirst()
'the columnvalues(1) the number represents the column number starting at 0
While Not(entryB Is Nothing)
If entryB.IsTotal Then
Messagebox entryB.ColumnValues(1),“PTO Exempt”
End If
Set entryB = nav.GetNext(entryB)
Wend
End Sub