Subject: RE: Refresh to show updated status & count
My suggestion is, do not refresh the form using uidoc.Refresh. Do not refresh the form at all. You probably have a formula in your computed fields that uses @Sum(@DbLookup(…)). This is not efficient.
Instead, write a “Computed when composed” field with the following formula: “”
You could either have one of these for each database, or just have one and write all your data into that. I’m going to assume the latter.
Now, write LotusScript code to get the user’s total from a categorized view with totals. So for instance, say there are five databases you want to read from. You could define global variables:
Dim databases(0 to 4) As NotesDatabase
Dim views(0 to 4) As NotesView
Dim uidoc As NotesUIDocument
In the form’s Initialize event, you could set each of the databases and views.
Set databases(0) = New NotesDatabase(“Fromage/NatlArsenimide”, “reqs\spoopinReqs.nsf”)
Set views(0) = databases(0).GetView(“RequestsTotalByAssignee”)
Set databases(1) = New NotesDatabase(…
The RequestsTotalByAssignee should be categorized by the name of the assigned person and contain a total column showing how many requests that person has.
Then you can have a little subroutine to update the information:
Sub UpdateTotals( )
dim session as new NotesSession
Dim i%, result$, newInfo$
dim entry as NotesViewEntry
for i = 0 to ubound(views)
set entry = views(i).GetEntryByKey(session.Username, true)
if entry is nothing then
newInfo = “no requests”
else
newInfo = entry.columnvalues(1) & " requests"
end if
results = results & {
} & databases(i).title & chr$(9) & newInfo
Next
Call uidoc.Document.replaceItemValue(“yourdisplayfield”, mid$(results, 2))
End Sub
And this is what you can call both from Postopen and from your timer routine.
The above assumes that the totals column has the same column number in each of your views. If this is not true, you might want to consider adding a third array – or create a little data structure that contains the database, view, and column number, and make a single array of those.