DOCUMENT #776
===========================================================================
VARIABLE-ONLY FORMS
===========================================================================
PRODUCT: R:BASE VERSION: 4.5+ or Higher
===========================================================================
CATALOG: Forms, Reports & Labels AREA : Forms
===========================================================================
You can think of a form as another way to prompt users to enter data into
variables. It can be an alternative to the FILLIN and DIALOG commands,
particularly if you need to prompt for many different values. Using a form
lets you prompt without programming. Users can move between the fields and
easily change entered values. You don't need to program this ability, it
comes with the form.
Using a table form to collect variable values lets you use the standard
ENTER and EDIT USING commands to call the form. No special programming is
needed and you have all of the other form options. Variable forms require
programming. They do not work with the ENTER and EDIT USING commands but
have their own special commands. You cannot access a variable form from
the menus. It can only be accessed through a custom program.
A regular form is associated with a table. It does not need to have any
columns located on it, however; you can locate just variables. The easiest
way to make a variable-only form is to create a dummy table in your
database. This is a single column table. You want to enter one row of dummy
data in the table.
For example,
CREATE TABLE dummy_tab (dummy_col INTEGER)
LOAD dummy_tab
L> 1
L> end
By loading a row of dummy data, you can call your variable-only form with
the EDIT USING command or the ENTER command.
Choose to create a custom form, select dummy_tab as the table. Locate the
desired variables on the form with supporting text as needed. You can use
expressions, customize field colors etc. Modify the Form settings to
select No menus for both adding data and editing data. After the users
enter the variables, they simply press Esc to leave the form.
The advantage of creating a table form with only variables located over
creating a variable form from the Form Create/modify menu is that you do
not need to write a program to use the form. After leaving the
variable-only form, the variable values are in memory (global variables)
for use by other aspects of your application -- other forms, reports,
custom code, etc.
Combine a variable-only form with other form techniques described in this
issue, for example, add an actions field to the form. Or the variable-only
form can be called by one of the actions. There are endless possibilities.