LotusScript code to compare number of marked messages
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?

Software/Hardware used:
ASKED: June 26, 2008  6:54 PM
UPDATED: July 8, 2008  3:48 PM

Answer Wiki:
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
Last Wiki Answer Submitted:  July 8, 2008  3:48 pm  by  CsHardwick   30 pts.
All Answer Wiki Contributors:  CsHardwick   30 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _