LotusScript: Checking another database for categories that do not contain a document of a particular type
More posts about: geek, lotus, work Tags: innovation-discovery, lotusscript // Add Comment »
We want to scale up Innovation Discovery and share the insights/workshop methods with more people, so one of my tasks is to remove sensitive information from our workshop output documents, post the scrubbed output documents in our community, and update the relevant sector page in our wiki.
This would be easier if people notified me after engagements, but at least we’ve gotten people into the habit of adding files to the Teamroom. I decided that instead of asking people to remember one more step in our post-engagement process, I would just regularly get into the habit of checking the Teamroom for updated documents. The Teamroom date view is useful, but there are other documents mixed into this, and I don’t think I can get my team members to adopt a consistent naming scheme or document type. However, if I wrote an agent to tell me which client categories didn’t have a final output document entry yet, I could use that to find new entries and follow up on old ones. So I did.
I didn’t have access to create new agents in the Teamroom database. I worked around this by creating this agent in my own database and then connecting to the other database from there.
Sub Initialize 'This script looks for all the client categories that do not have a final documents entry 'Display the current document's Categories field Dim dbID As New NotesDatabase("","dbom1\global18.nsf") Dim doc As NotesDocument Dim catView As NotesView Set catView = dbID.getView("CategoryLookup") 'Determine list of clients Set doc = catView.Getfirstdocument() Dim clients List As String Dim finished List As String Do Until(doc Is Nothing) Dim category As String category = doc.Getitemvalue("Categories")(0) If (InStr(category, "Clients") <> 0) Then 'This belongs in the client category. Has it been found? Add it to the list category = Mid(category, 9) clients(category) = category If (doc.GetItemValue("DocType")(0) = "Final output") Then finished(category) = category End If End if Set doc = catView.Getnextdocument(doc) Loop 'Remove completed items Dim s As String s = "" ForAll client In clients If (Not IsElement(finished(client))) then s = s + client + " " End if End ForAll MessageBox(s) End Sub
I change entries to the “Final output” document type after I’ve processed them. So far, so good!