Manage Learn to apply best practices and optimize your operations.

Automatically update choice list

You have a dialog list for selection of, keywords, and you mark the "allow values not in list" checkbox. This tip shows you how to automatically update the choice list.

If you mark the "allow values not in list" checkbox on a dialog list for selection of keywords, and you want each value to become available as a new keyword to all documents once you have entered it., create the dialog list based on a @Dblookup-s (hidden) view of keywords formula. Then, use the following code to make sure the new words are added to this view.

  Sub Exiting(Source As Field)
 ' Add the words to the Keywords view 
 Dim workspace As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Set uidoc = workspace.CurrentDocument
 Dim textString As String
 textString = uidoc.FieldGetText
' Messagebox (textString)
 ' Tokenize the string 
 Dim Keywords As  Variant
 Keywords = Split(textString, ",") 
 Dim i As Integer, j As Long
 For i = 0 To 10
  Err = 0
  On Error Resume Next
  If Keywords(i) = Null Then Exit For
  If Err <> 0 Then Exit For
  Keywords(i) = Trim((Cstr(keywords(i))))
 ' Now we need to add them to the Keywords view 
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim doc As NotesDocument
 Set db = session.CurrentDatabase
 Dim collection As NotesDocumentCollection
 Dim dateTime As New NotesDateTime( "01/01/04" )
 For j = 0 To i-1 
  Dim SearchFormula As String
  SearchFormula = "@Contains(Keyword;""" 
+ keywords(j) + """)"
  Set collection = Nothing
  Set collection = db.Search(SearchFormula,
  If collection.Count = 0 Then ' no such document
   Set doc = New NotesDocument ( db )
   doc.Form = "Keyword Form"
   Call doc.AppendItemValue("Keyword", 
   Call doc.Save( True, True )
  End If 
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Amnon Ribak. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...