This is a popular problem with several different answers.
The most straightforward way, the way that does just exactly what you asked for, is to use code in the Postsave event of your form. The Postsave code would use LotusScript to locate the document where the keyword fields are stored (NotesView.GetDocumentByKey), compare them with the values in the current document, add any new values to the keyword document (AppendToTextList) and try to save using NotesDocument.Save(False, False). Check the return value of Save to make sure that the save succeeded. If another user is doing the same thing at the same time, you may get a save conflict. In that case, you must reload the keyword document (use the Delete statement to remove it from the LotusScript document cache) and repeat the above process.
There are some drawbacks to this approach. It doesn't work well if there are multiple replicas of the database because there are likely to be replication conflicts as different users add keywords in different replicas, updating the same document.
A different technique that works well in a replicated environment is to create a hidden view especially for this keyword lookup. Write the view selection formula so that it includes both your keyword document and also your calendar documents:
SELECT Form = "CalendarEntry" | (Form = "Keyword" & Type = "CalendarCategory")Categorize the first column and enter a formula there that tests the form and gives the list of values on that form:
@If(Form = "Keyword"; KeywordValues; Categories)This assumes KeywordValues is the name of the multi-value field on the keyword configuration document and Categories is the name of the field containing these values on the CalendarEntry form.
Now, by doing an @DbColumn to this hidden view, you can get all the category values that have been entered in the keyword form, plus all the category values that were added since, all in alphabetical order.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.