I’m new to Lotus Notes development. I am trying to create a contact history subform that needs to store multiple records of two fields each, date and comment. I have tried using a multivalue field and a button and updating the field with LotusScript, but it won’t let me add any delimiter characters using LotusScript. What’s the best way to do this in Notes?
Thanks
Subject: Try ArrayAppend
i.e.doc.Comments = ArrayAppend(doc.Comments, newComments)
doc.ContactDates = ArrayAppend(doc.ContactDates, Now)
Subject: Multiple rows in subform
One option. Here’we have an editable Input field and a computed InputHistory field. We want to add the contents of the Input field to the InoutHistory field, along with the date/time, user name, and a line dividing the entry from the previous entries. If the user didn’t enter anything in Input, we want to ignore it.So:
'Update the InputHistory field and the WorkHistoryText field if the user added text to the Input field. Reset the Input field for the next save.
Set item = doc.GetFirstItem( “Input” )
If ( item.text <> “” ) Then
WorkHistoryText = dateTime.LSLocalTime & " -- " & user & Chr(13) & Chr(10) & item.text
doc.InputHistory = doc.InputHistory(0) & Chr(13) & Chr(10) & WorkHistoryText & Chr(13) & Chr(10) & "_____________________________________" & Chr(13) & Chr(10)
doc.Input = ""
Else
doc.InputHistory = doc.InputHistory(0)
End If
I’m sure this could be prettier. Also, the ArrayAppend approach Bill Ernest posted might work better, depending on what you’re trying to do.
Subject: RE: Multiple rows in subform
Thanks for your replies. The ArrayAppend approach works good. Actually, it works the same as using
Dim item As NotesItem
Set item = Doc.GetFirstItem(“ContactHistory”)
Call item.AppendToTextList(HistoryItem)
What I’m really looking for is some type of dynamic table so that the date stamp and comments are always in separate columns. There’s no way to put a table inside a field, is there? I guess I’ll try some type of string manipulation (counting characters, inserting a newline).
Thanks again