======================================================================
TRANSFER DATA FROM BROWSE/EDIT TO A FORM
======================================================================
PRODUCT: R:BASE VERSION : 4.0
AREA : DATA QUERY CATEGORY: TRANSFER DOCUMENT#: 655
======================================================================
In R:BASE 4.0 Browse/edit you can copy data from a column into a
variable, called #BROWDATA, then access that variable after leaving
Browse/edit.
You can use Browse/edit to view data and then use #BROWDATA to return a
value to a form where a menu is not applicable. This can be because you
want to choose a value from a great many rows or columns of data or
because you need to compare values from more than one table.
To capture data from Browse/edit into the #BROWDATA variable, simply
move to the field containing the desired data and press Shift-F10. The
data from that row and column is now contained in the #BROWDATA vari-
able. You can then use the variable #BROWDATA in a form or command file.
#BROWDATA provides an easy way to select a value from large amounts of
data.
An Example Using an EEP
=======================
Here's a simple entry/exit procedure (EEP) that displays the Browse/edit
screen. Note that you can customize the BROWSE command to display fields
in colors, lock columns, make data read-only, and prevent the user from
changing the query by switching to QBE.
*(BROWDATA.EEP)
SET ERROR MESSAGE OFF
SET MESSAGE OFF
SET VAR vcustid INTEGER
BROWSE custid=READ=MAGENTA=6,company=READ=CYAN=25, 'Choose a +
CUSTOMER I.D. by hitting SHIFT-F10'= BLACK=44 FROM customer NOQBE
SET VAR vcustid=.#BROWDATA
RECALC
RETURN
You can place this EEP on the sample form tranform in the CONCOMP
database as follows:
Delete the field custid by pressing SHIFT-F9. Press SHIFT-F6 and locate
vcustid in its place. For vcustid, choose NO to define an expression,
choose INTEGER as the data type, and choose YES to modify field settings.
Enter BROWDATA.EEP as the name of the entry procedure to execute.
Now that you have replaced custid with vcustid, create an expression to
place the value of vcustid into the column custid so it is stored in the
table. Choose Define from the Variables menu and add the following
expression to the transmaster table:
custid=.vcustid
When the row is added, the expression is read, and the column custid is
updated with the current value of vcustid, which was selected in Browse/
edit and has been transferred to the form via #BROWDATA.
When the user moves into the CUSTID field on the form (now the variable
vcustid), the EEP browdata.eep is run. The EEP places the user in the
Browse/edit screen, where he or she can choose the appropriate customer.
After pressing Shift-F10 to select the value, the user must exit Browse/
edit to return to the form, where the selected value selected appears in
the vcustid field. The form uses the selected value to look up the
customer information.
Use a Keymap to Select the Data
===============================
As an alternative, you can define a keymap to select the data and exit
Browse/edit. Press Ctrl-F1, and choose Define a keymap. Specify Alt-C as
the key to define. Enter the following keystrokes in the order shown:
1. Shift-F10. This selects the value and places it in #BROWDATA.
2. Esc. This moves to Exit on the Browse/edit menu.
3. Enter. This executes the Exit action and leaves Browse/edit.
4. Enter. This leaves the vcustid field in the form and executes the
lookup
5. Shift-F8. This moves to the transdetail table in the form.
6. Ctrl-F2. This ends the definition.
When the user has moved the cursor to the desired row and column in
Browse/edit, he or she can press Alt-C to select the data into #BROWDATA
and return the user to the form. Keymaps can be saved in the RBASE.CFG
file or automatically created using a script file.