""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
GET EDITABLE FORM FIELD DEFAULT FROM ANOTHER TABLE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
PRODUCT : R:BASE VERSION : 3.1
CATEGORY : FORMS SUBCATEGORY : FIELD DEFAULT
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
By using a lookup expression, you can give a field in a data entry
form an initial default value that comes from another table. But if
you want the user to be able to change that value for the current
table, you need to locate variables instead of columns, and use two
expressions for each column--one to look up the default value, the
other to load the value into the table.
For example, in an order form, you might want to look up the usual
shipping address in the CUSTOMER table but still make it possible for
the data entry operator to enter a different shipping address into the
ORDERS table for a specific order. To do this, you need to locate
variables instead of columns in the form for each element of the
address (for example, VORD_ADDR1, VORD_ADDR2, VORDERZIP). Customize
the field characteristics for each variable field to answer "Yes" to
the question "Will new data be entered in the field?" Then add pairs
of expressions like these for each element of the address:
vord_addr1 = ship_addr1 IN customer WHERE custid = custid
ord_addr1 = .vord_addr1
The first expression looks up the value in CUSTOMER, the second loads
the field value into ORDERS so the data entry operator can change the
value in the VORD_ADDR1 field before it's loaded.