READ FORM [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
READ FORM
The READ FORM statement assigns the values entered into the fields of a
VPLUS form to HP Business BASIC/XL variables. A time limit for input can
be specified by using the TIMEOUT clause.
Syntax
READ [FROM] FORM
[ [{,} ]]
[form_item [{;} form_item...]]
[{,} ]
[{;} TIMEOUT [=] time_expr]
[{,} ]
[{;} NOEDIT [[=] key_number_list]]
Parameters
form_item One of the following:
form_element
for_clause
skip_clause
form_element One of the following:
num_var
str_var$
array_name ([*[,*]...])
str_array_name$([*[,*]...])
The last two formats above have one asterisk per
dimension or does not use asterisks. Not using
asterisks specifies any number of dimensions. Either
format is legal, but the format without asterisks is not
compilable. Substrings are also allowed.
for_clause (FOR num_var=num_expr1 TO num_expr2 [STEP num_expr3],
form_item [, form_item]...)
A for_clause is useful for reading array elements.
Refer to the INPUT statement for more information.
skip_clause SKIP skip_expr
A skip_clause is used to skip one or more fields in the
form to avoid the necessity of assigning them. The
skip_expr is a numeric expression that evaluates to the
number of fields to skip.
time_expr Time_expr is a numeric expression that evaluates to the
number of seconds that you have to fill in any input
fields on the form. You must depress the ENTER key or a
user-defined branch-during-input key before this time or
an HP Business BASIC/XL error occurs. Under the latter
conditions, no input is assigned to the form
variable(s).
key_number_list A list of integers or numeric expressions that evaluate
to an integer in the range of [1..8] separated by commas
or semicolons. No more than 8 values can be specified
for each statement. If the integer is not in the
specified range, an error occurs. If you do not specify
values, all keys do not have editing completed.
The READ FORM statement is terminated by pressing the ENTER key or a
user-defined branch-during-input key. Fields with matching data items
are converted and assigned to the corresponding HP Business BASIC/XL
variables.
The READ FORM statement is designed to assign the information in all the
fields on an entire screen at once. Each field is assigned to a single
variable or array element. The first form_item is assigned the value of
the first field on the form, the second form_item is assigned the next
value, etc. Each variable specified in a for_clause is assigned the
value from a single field. Each element of the array specified by the
array_name(*) notation is also assigned from a single field.
Skip_clause is used; for example, if you wish to only assign the value of
the fourteenth field to a variable without reading and converting fields
one through thirteen. Simply include the option, SKIP 13.
The following is an example of a READ FORM statement that assigns values
from a form with at least 13 fields assuming the A array has five
elements and the B$ array has two elements.
READ FORM Surname$, Firstname$, Initials, SKIP 3, &
(FOR I=1 to 5 STEP 2,A(I)), B$(*), Choice1$, Choice2$
The first three fields are read into Surname$, Firstname$ and Initial$.
The next three fields are ignored. The for_clause reads values into
A(1), A(3), and A(5). B$(*) reads values into B$(1) and B$(2). The
twelfth and thirteenth fields are read into Choice1$ and Choice2$
respectively. This same statement causes a run-time error if the active
form has fewer than thirteen fields.
The TIMEOUT clause requires that you respond within a set amount of time.
If input is not complete within this time, an error condition occurs.
The built-in RESPONSE function returns a value of two.
If no VPLUS form is active, or a JOINFORM is active, executing a READ
FORM statement causes a run-time error. See Appendix F for information
on reading values from a JOINFORM form.
Examples
The following examples show the READ FORM statement.
300 READ FORM
310 READ FORM A;TIMEOUT=100
320 READ FROM FORM A;TIMEOUT 100;NOEDIT=8
330 READ FORM A,B;C$;NOEDIT
340 READ FORM A,SKIP 2;C$
MPE/iX 5.0 Documentation