Emailing a list of changes
Sep 16, 2009
The integration of email and databases are a great strength of Lotus Notes: there is no additional sign-ins the names are the same and links work. I've recently been asked to sent a notice to a person whenever one or more of a list of options are checked. Not a problem coding for that is pretty simple. But I want to send a comprehensible email, at least tagging what the changes have been. Well, arrays work for that, you can create one, resize it and pop it over no problem. But that's a lot of work and memory. Oh, wait, I have to list the changes, why not use a List? Duh. OK, so I'm doing that. No resizing, and it grabs what I want, easy. I did a little testing before I started coding this into  my application, and that's below. I put his in my code database because I'm sure I'll be using it more in the future. I'm sure other people have been doing this sort of thing for a while, but it never hurts to put things out there: there are all sorts of functions and methods we just don't think of.

        Dim testList List As String
testList("first" ) = "Hmm, here is the start of a list"
testList("second" ) = "Continue the list"
testList("third" ) = "OK, we're ending it now"
Call SendMessage(testList, db)

Function SendMessage (testList List As String, db As NotesDatabase) 
         Dim thebody As Variant
Set thebody = New NotesRichTextItem(memodoc, "Body" )
Call thebody.AppendText("Here is a test of passing lists" )
Call thebody.AddNewLine(2)
If Iselement(testList("first" )) Then
Call thebody.AppendText("First - " & testList("first" ) )
End If
Call thebody.AddNewLine(2)
       Forall i In testList
Call thebody.AppendText(Listtag(i))
Call thebody.AddNewLine(1 )
End Forall
Call memodoc.Send(False)
End Function

This is an archive of my previous blog attachments are in the download control