Ask the Expert

Saving entries to a feeding form from a destination form

I have a keywords form that populates a number of keywords fields on a calendar entry form. I want the capability to add keywords to the keywords field on the calendar entry form and have them append to the keywords form and stay. Is this possible? Any help will be greatly appreciated.
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.

This was first published in April 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: