entry/change in field1 updates field2 on form

paulgagnon
paulgagnon used Ask the Experts™
on
This should be the simplest thing in Notes, but it isn't or I am seriously missing something.

I have a "locform1" form that has 2 fields on it... location1 and person1.   There is a view that selects those  location documents called locview1.  Essentially this serves as a lookup mechanism for combo and dialog lists in other forms and allows the users to maintain their lists dynamically.

I have a form called msdsform1.   There are 2 fields on the form, field1 and field2.   When someone picks/sets a value in field1 with the contents of location1, then field2 should get populated with the contents of person1.

What I have done in the past is to create a hidden field on the form that is calculated when composed.  Then use an action hotspot or button to pop up an @picklist using the "view" parameter and then surrounding that with an @setfield and setting my hidden field to the docid.  Then call an agent in lotusscript that retrieves the contents of the hidden field and does a get doc by unique id using that as the key and then followed by a bunch of setfields to update values on the form.

Although this works, I think it is crazy.

My next thing to try is to create a locform1 with a blank location1 field.  Then set the default value of field2 to an @dblookup statement and change field 1 to refresh keywords on change.  I doubt the @dblookup will reexecute and update with the correct value... but I will try it.

There has to a better way of doing this that I'm just plain missing.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Set FIELD1, Refresh fields on keyword change property. And then use dblookup for second field and set refresh choices on document refresh. This will work.

~Hemanth

Author

Commented:
I set both FIELD1 and FIELD2 to refresh choices on keyword change and both to refresh choices on document refresh.

The @dblookup is in the default value of FIELD2 and works becuase it pulls in the correct default value, so it executes the lookup properly on document creation.

It doesn't work though when I click my entry helper button on FIELD1 and select a location (from the dialog list/editable/use view dialog for choices).  It correctly fills in FIELD1 as it should, but FIELD2 sits there and remains unaffected.  Even pressing F9 while in edit doesn't update FIELD2 when there is a new value loaded into FIELD1.  Saving the document doesn't help either.

See this is why I love and hate Notes at the same time.  This should be this simple, should work, yet it doesn't.
Commented:
"Default value" is default value. Just the default value you get once when the field is new.

Why not set the field to be Computed (maybe even computed for display), instead of editable?
Use Nocache option in your dblookup. It will help

Author

Commented:
A terrific notes programmer showed me a very cool trick to solve this.

My problem was stemming from the fact that all the fields needed to remain editable otherwise it worked when I made field2 a computed field.

To solve it he used a single line javascript to click a hidden button on the form in the onBlur event.

The hidden button has a lotusscript behind to retrieve the data by key and populate field2.  

This way I get the best of both, editable behaving like a computed field, sort of.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial