Objective: 
Append a text string to an existing list saved in a field. 
 
Solution A: 
Dim s as New NotesSession 
Dim cDoc as NotesDocument			' current doc 
Dim cFld as NotesItem				' field with list 
Dim newstr as String				' new value to append to list 
 
Set cDoc = s.DocumentContext 
Set cFld = cDoc.GetFirstItem("MyListFld") 
newstr = "newlistitemtoadd" 
If Not (cFld is Nothing) Then 
	If (cFld.Type = 1280) Then 
		' field type is text or text list - process 
		Call cDoc.ReplaceItemValue( "MyListFld", ArrayAppend( cFld.Values, newstr) ) 
		Call cDoc.Save(True, False) 
	End If 
End If 
 
 
Solution B: 
Dim s as New NotesSession 
Dim cDoc as NotesDocument			' current doc 
Dim cFld as NotesItem				' field with list 
Dim oldLst as Variant				' the old list 
Dim newLst as Variant				' the new list 
Dim newbound as Integer			' counter upper bound/limit for newLst 
Dim newcount as Integer			' counter for newLst 
Dim newstr as String				' new value to append to list 
 
Set cDoc = s.DocumentContext 
Set cFld = cDoc.GetFirstItem("MyListFld") 
newstr = "newlistitemtoadd" 
If Not (cFld is Nothing) Then 
	If (cFld.Type = 1280) Then 
		' field type is text or text list - process 
		oldLst = cFld.Values 
		newbound = Ubound( oldLst) + 1 
		Redim newLst(newbound) 
		' add old values to new list 
		For newcount  = 0 to Ubound(oldLst) 
			newLst(newcount) = oldLst(newcount) 
		Next newcount 
		' add new string 
		newLst(newbound) = newstr 
		' write new list/array to field 
		Call cDoc.ReplaceItemValue( "MyListFld", newLst() ) 
		Call cDoc.Save(True, False) 
	End If 
End If 
 
 
  
previous page
 
  |