Appending to Multi-Value Field

I need some Lotus Script help to appending text to a multi-value field using a messagbox.


Private Function PromptRemarks( row%, doc As notesdocument ) As String

' prompts the remarks dialog

' returns the remarks

Dim wfuiwork As New NotesUIWorkspace

Dim docDlg As New NotesDocument( doc.ParentDatabase )

Dim remarks$

Dim subj As Variant

’ Added to display contents of field

Dim workspace As New NotesUIWorkspace

Dim wfNotes

Dim uidoc As NotesUIDocument



On Error Goto errorHandling



Call docDlg.ReplaceItemValue( WF_FIELD_DLG_MSG, MSG_DLG_REMARKS )

If Not wfuiwork.dialogbox(  WF_FORM_DLG_REMARKS, True, True, False, False, False, False, MSG_DLG_TITLE_REMARKS, docDlg, False, False,True ) Then

	Print MSG_USER_CANCEL

	PromptRemarks =""

Else

’ Display the current value of Remarks field

	wfNotes = (WF_FIELD_REMARKS & row%)		



	subj = doc.GetItemValue( wfNotes )		

	

	remarks$ = docDlg.GetItemValue( WF_FIELD_DLG_TEXT )(0)

	Call doc.AppendItemValue( WF_FIELD_REMARKS & row%, remarks$ )

	

	PromptRemarks = remarks$

End If



Exit Function

errorHandling:

Call ErrorHandling( "PromptRemarks", Err, Error$, "Row: " & Cstr(row%))

PromptRemarks = ""

Exit Function

End Function


doc.AppendItemValue doesn’t do anything to the field. However, doc.ReplaceItemValue works fine to replace the entire field with the new value.

Please help.

Subject: Appending to Multi-Value Field

Hi kim,

I hope this example code helps.

Dim doc As NotesDocument

Dim item As NotesItem

’ …set value of doc…

Set item = doc.GetFirstItem( “Categories” )

Call item.AppendToTextList( “Shocks” )

Call doc.Save( False, True )

Subject: RE: Appending to Multi-Value Field

Yes, I finally got this to work. Thank you both.

Subject: Appending to Multi-Value Field

doc.AppendItemValue adds a new item to the document with the value specified. To do what you want to do you need to get the field as a notesitem and then use notesitem.AppendToTextList