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 ("AssetKeywords") ' 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)))) Next ' 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, dateTime,0) If collection.Count = 0 Then ' no such document Set doc = New NotesDocument ( db ) doc.Form = "Keyword Form" Call doc.AppendItemValue("Keyword", keywords(j)) Call doc.Save( True, True ) End If Next End Sub
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com 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.