DISPLAY ARRAY statement is a special case of the DISPLAY statement which includes most of the additional clauses common for INPUT and INPUT ARRAY statement as well as its own additional clauses.
Binding clause |
This is an obligatory clause which specifies the program array and the record array to which it must be displayed |
ATTRIBUTE clause |
An optional ATTRIBUTE clause where the attributes for the fields used in the DISPLAY ARRAY statement can be specified |
HELP clause |
An optional HELP clause where the help number for the DISPLAY ARRAY statement can be specified |
WITHOUT SCROLL clause |
This optional clause consists of the WITHOUT SCROLL keywords |
INPUT control block |
An optional DISPLAY control block which controls the display of the data |
DISPLAY ARRAY statement is used to display program arrays to screen arrays; it may include optional clauses.
To use the DISPLAY ARRAY statement, follow these steps:
Specify a screen array in a form specification file
DEFINE an ARRAY of program records. The members of the records must match the fields of the previously specified screen array in order, number and data types
Open and display the form that contains the specified screen array (you may use the OPEN FORM and then the DISPLAY FORM statements or the OPEN WINDOW ... WITH FORM statement)
Populate the program array with the data to be displayed
Call the set_count(i) built-in function. Here, "i" is the number of the records filled with data
Use the DISPLAY ARRAY statement to display these data to a screen array
set_count() specifies the initial value for arr_count(). If it is not set, no data will be displayed.
The data types of the values in each record should correspond to the data types of the fields of the screen array. The size of screen array determines the number of program records 4GL can display at a time. The size of a program array determines the number of data it can store. If the size of a program array is larger than the size of a screen array, the user can scroll through the rows in the form.
DISPLAY ARRAY statement has this effect:
The values of the program array are displayed to the fields of the screen array
The cursor is moved to the first field of the first screen record
The user is expected to press either scroll key or accept key.
DISPLAY ARRAY statement is not terminated until the Accept or Interrupt key is pressed, unless it includes the WITHOUT SCROLL keywords.
The values are displayed by means of the DISPLAY ARRAY statement in the same way as by the DISPLAY statement:
Numbers are right-justified, if a number does not fit the field length, an asterisk is put in the field instead. (currently 4GL does not display anything)
Literal strings and TEXT values are left-justified, if a literal string is longer than the field, the superfluous symbols are truncated from the right
BYTE values cannot be displayed with the help of DISPLAY statement, the field will display <byte value> instead. To display a value of BYTE data type use PROGRAM statement.
If you use the DISPLAY ARRAY statement independently, you can omit END DISPLAY keywords.
If you use DISPLAY ARRAY within any dialog block, END DISPLAY keywords are required.
When you call INPUT, INPUT ARRAY, or DISPLAY ARRAY statements from another DISPLAY ARRAy, you must explicitly specify the end of the embedded statement (by END INPUT or END DISPLAY). Otherwise, you will get the compilation error because the compiler will not understand the order of statements and their clauses.