Subject: RE: Field Change
There is an EI Forum for LEI-related questions.
You didn’t specify what type of LEI activity you were using. It can make a difference.
If you have a Notes connection document, there are “transformation” fields where you can enter formulas to convert values from the relational database into different values to store in Notes fields, and vice versa.
If there is no Notes connection document, the activity document contains fields under the event options tab. There also you can enter formulas that execute when the document is opened or saved. In your case, you would want the following for a Postopen event:
SELECT @All;
FIELD prodbaseos2 := @If(prodbaseos = 1; “Yes”; “No”)
and the following for a pre-update formula:
SELECT @All;
FIELD prodbaseos := @If(prodbaseos2 = “Yes”; 1; 2)
Now that I’ve answered the question, here are a few comments about your use of formula language in general:
The “input translation” formula executes when the user saves the document. It is not used when a document is opened. The “default” formula is used to assign a value to a field that doesn’t already have one. It is not used when a document is opened unless the field doesn’t already have a value. There is no formula that assigns a field when an existing document opens, if that field already has a value.
Do not use a FIELD statement in the field’s input translation formula or default formula to assign that field. E.g. instead of
FIELD x := “somevalue”
the formula would just be
“somevalue”
The FIELD statement can be used to assign some other field; though in most cases, it’s better to associate the formulas that assign a field with that field, not some other field.
Consider this statement:
FIELD prodbaseos2 := @If(prodbaseos = 1; prodbaseos2 = “Yes”; prodbaseos2 = “No”); “”;
There are several problems with it.
= does not do an assignment; it tests for equality, returning TRUE or FALSE. The assignment operator is :=. Your @If function in this case will therefore return the value TRUE or FALSE, which is not the type of value you want to assign to prodbaseos2.
Even if you use := in this formula instead of =, to assign a field you must use the FIELD keyword.
Exception: Don’t use a FIELD statement in the field’s input translation formula or default formula to assign that field. E.g. instead of FIELD x := “somevalue” the formula would just be “somevalue”
So in this case, your corrected formula would be:
@If(prodbaseos = 1; “Yes”; “No”)
Except, of course, that it’s better to use the formulas on the activity document or connection document in this case, because this formula doesn’t deal with the problem of changing prodbaseos value when the user edits prodbaseos2 and saves the document.