Genii Weblog

A typical Midas request

Mon 6 Nov 2006, 11:08 AM



by Ben Langhinrichs
A developer called today because she had been told by another developer familiar with our Midas Rich Text LSX that the product might be able to help her with a client issue.  The client had created thousands of documents over the years with newsletters, and the newletters pointed to files on a shared drive.  So, thousands of documents, from a few to hundreds of URL hotspots in each, and of course the company decides to change the whole file system scheme.  So, for example:

example of CURRENT:
P:\KKL\Overt ProdSol Access\Competitive Products\Tiny Tyranasaurus\HHGR56 TransFat008.pdf

example of NEW:
S:\Overt PSA\Competitive Products\Tiny Tyranasaurus\HHGR56 TransFat008.pdf

So, I offered to write an agent to show her how to do this, as I figured it would take less time than having her go through the learning curve herself.  The agent is below.  

So why do I title this "A typical Midas request"?  Because 

a) The product was recommended by another developer familiar with Midas.  Virtually all leads for Midas come through personal recommendation.
b) The developer was dubious about the ability of Midas to handle the problem, but was quickly convinced.
c) The full agent took up only 25 lines of code, with only one of those doing the lion's share of the Midas work.  Most solutions are quick and easy.
d) The agent itself is wickedly fast.  Both because Midas is written in efficient C API code and because a single method handles all changes, most agents are extremely fast.
e) It took less time to write the agent than it did to blog about it.  Sigh!

Sub Initialize
   ' *** Notes class objects
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim collection As NotesDocumentCollection
   Dim doc As NotesDocument
 
   ' *** Midas class objects
   Dim rtitem As New GeniiRTItem
 
   Set db = session.CurrentDatabase
   Set collection = db.UnprocessedDocuments
   Set doc = collection.GetFirstDocument
   While Not (doc Is Nothing)
      count = count + 1
      Call rtitem.ConnectBackend(doc.Handle, "Description")
      If rtitem.IsConnected Then
         If rtitem.Everything.GetCount("URLLink") > 0 Then
            Call rtitem.Everything.ReplaceText("P:\KKL\Overt ProdSol Access\", "S:\Overt PSA\", "URL")
            rtitem.Save
         End If
      End If
      Set doc = collection.GetNextDocument(doc)
   Wend
End Sub

Copyright © 2006 Genii Software Ltd.

What has been said:

No documents found