About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« Book Review - The Gatherer by Jerry Bayne | Main| My feelings aside about the whole polygamous issue... »

A bit of code that can make your TeamStudio Configurator reports a bit easier to work with...

Category Software Development

I had a request from an internal customer today involving scanning a particular Notes database for the occurrence of some specified strings.  This is related to a request from Legal, so of course it needs to be accurate and the results need to be easy to use.  After listening to what she was trying to do on her own, I suggested that it would be best if I did the scans for her, using the TeamStudio Configurator tool.  So far, so good.

The only issue I have with the output from the tool is that the Configurator report only shows you the string being scanned for along with the document title and Notes ID.  But unless you're a Notes geek, that Notes ID means virtually nothing to you as an end user.  In those cases, the users try to find the document title in the database.  Not pretty...

I wrote the following quick and dirty code to put behind an action button that I add to the Configurator report form design.  It's meant to be used under the condition that you have a separate report document for each string match.  Feel free to steal or appropriate as needed...

Sub Click(Source As Button)
 
 Dim session As New NotesSession
 Dim ws As New NotesUIWorkspace
 Dim dbThis As NotesDatabase
 Dim dbScanned As NotesDatabase
 Dim uidocThis As NotesUIDocument
 Dim docThis As NotesDocument
 Dim docScanned As NotesDocument
 
 'Stores the primary extracted strings needed to get the document that matched the scan
 Dim strScannedDBServer As String
 Dim strScannedDBPath As String
 Dim strScannedNoteID As String
 Dim intStart As Integer
 Dim intEnd As Integer
 
 Set dbThis = session.CurrentDatabase
 Set uidocThis = ws.CurrentDocument
 Set docThis = uidocThis.Document
 
 'This grabs the canonical server name stored in the frptDatabase field of the Configurator Report document
 intStart = Instr(1, docThis.frptDatabase(0), "CN=")
 intEnd = Instr(intStart, docThis.frptDatabase(0), "(")
 strScannedDBServer = Mid$(docThis.frptDatabase(0), intStart, intEnd - intStart)
 
 'The file path follows the canonical server name, so grab that here.
 intStart = intEnd + 1
 intEnd = Len(docThis.frptDatabase(0))
 strScannedDBPath = Mid$(docThis.frptDatabase(0), intStart, intEnd - intStart)
 
 'Finally, the NoteID of the scanned document is stored at the end of the frptNoteTitle field of the Configurator Report document
 intEnd = Len(docThis.frptNoteTitle(0))
 intStart = intEnd - 8
 strScannedNoteID = Mid$(docThis.frptNoteTitle(0), intStart, 8)
 
 'You have everything you need to get the scanned database and document now.
 Set dbScanned = session.GetDatabase(strScannedDbServer, strScannedDbPath)
 Set docScanned = dbScanned.GetDocumentByID(strScannedNoteID)
 
 If Not (docScanned Is Nothing) Then
  Call ws.EditDocument(False, docScanned, True)
 Else
  Messagebox "NoteID " + strScannedNoteID + " not found"
 End If
 
End Sub


EDIT 10/13/2008 - John Kingsley from TeamStudio suggested making the following change in the code so it would work for both server-based and local databases...  Thanks, John!

This post was fabulous.  I had to make some changes to it because they don't let me near any servers here, so everything is local.  Try this

instead of

'This grabs the canonical server name stored in the frptDatabase field of the Configurator Report document
 intStart = Instr(1, docThis.frptDatabase(0), "CN=")
 intEnd = Instr(intStart, docThis.frptDatabase(0), "(")
 strScannedDBServer = Mid$(docThis.frptDatabase(0), intStart, intEnd - intStart)
 

try this.

'This grabs the canonical server name stored in the frptDatabase field of the Configurator Report document
        If Instr( 1, docThis.frptDatabase( 0 ), "CN=" ) Then
                intStart = Instr(1, docThis.frptDatabase(0), "CN=")
                intEnd = Instr(intStart, docThis.frptDatabase(0), "(")
                strScannedDBServer = Mid$(docThis.frptDatabase(0), intStart, intEnd - intStart)
        Else
                intStart = Instr(1, docThis.frptDatabase(0), "Local")
                intEnd = Instr(intStart, docThis.frptDatabase(0), "(")
                strScannedDBServer = ""                
        End If

Comments

Gravatar Image1 - Hey Tom, Good idea. I'ts sometimes hard to remember not everyone is a "Lotus Geek". I am going to add it to my code library
John

Gravatar Image2 - Great suggestion, Duffbert! We're working on a way to allow Teamstudio fans to contribute (and find) tips and tricks for using our products. Coolidge is involved in it as well, and of course we'd welcome your participation too.

Stay tuned... Emoticon

Rock
(VP of Products, Teamstudio)

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...