Question

  Asked: Jun 26 2008   6:54 PM GMT
  Asked by: Domino Ask The Experts


LotusScript code to compare number of marked messages


LotusScript, Lotus Notes, Email monitoring

When sending email to multiple addressees and receiving answers which are again sent to many users, this creates a large amount of redundant information.

Is there any LotusScript code that I could use to compare a number of marked messages with a defined "master message" (usually the newest) and remove duplicate sections in the marked (older) messages?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Well that's really two questions isn't it? First, how to get a handle on the documents and there contents, and second, what algorythm to use to compare and trim the text?

To get a handle on the selected documents, you only have to use the database unprocessed documents collection. From an agent set to run on selected documents, this will always return the selected documents. The documentation says they are returned in random order, but actually that's not true. They are, in fact, returned in the order they were added to the database, so you can easily grab the most recent document without any need to sort or process the list.

Then you have to look at the contents. The Body field in a Notes email is a RichText field and LotusScript only provides an easy way to get at its text contents. So if you want to be able to preservce rich text contents, your little project is quickly going to get very costly. But if you are content to trim the older messages down to archival text, you might do something like this:

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim Selected As NotesDocumentCollection
Dim Doc As NotesDocument
Dim Master As NotesDocument

Set db=session.CurrentDatabase ' Get handle to database
Set Selected=db.UnprocessedDocuments ' Get collection of all selected documents.

Set Master=Selected.getnthdocument(1)
Dim MasterBody As NotesRichTextItem
Dim MasterBodytext As String
MasterBody=Master.GetRichTextItem("Body")
MasterBodytext=MasterBody.GetFormattedText(True,80)
For i=1 To Selected.Count ' Scan selected documents (In the order they were added to the database).
Set doc=Selected.getnthdocument(i)
Dim Body As NotesRichTextItem
Dim Bodytext As String
Body=Doc.GetRichTextItem("Body")
Bodytext=Body.GetFormattedText(True,80)

. . . INSERT COMPARISON CODE HERE ...
Doc.RemoveItem("Body")
Set Body = new NotesRichTextItem(Doc,"Body",TheTextToKeep)
Call Doc.Save(True,false,false)
Next ' i


End Sub
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Lotus Domino and Exchange.

Looking for relevant Lotus Domino Whitepapers? Visit the SearchDomino.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register