Understanding the DISPLAY ARRAY instruction
The DISPLAY ARRAY
dialog controls a list of records.
DISPLAY ARRAY
is designed to browse a list of records, binding a static or
dynamic array model to a screen array of the current displayed form.
A DISPLAY ARRAY
instruction supports additional features such as drag
& drop, tree-view management, built-in sort and search, multi-row selection and list
modification triggers. For a detailed description of these features, see Table views.
Use the DISPLAY ARRAY
instruction to let the end user browse in a list of rows
after fetching a result set from the database. The result set is produced with a database cursor
executing a SELECT
statement. The SELECT
SQL statement is usually
completed at runtime with a WHERE
clause produced from a CONSTRUCT
dialog. When the DISPLAY ARRAY
statement completes execution, the program must test
the int_flag
variable to check if the dialog was
validated or canceled. If int_flag
is FALSE
, the program can get
the current row from arr_curr()
.
Depending on the type of DISPLAY ARRAY
, you must implement dialog data blocks.
When the user browses the list, dialog control
blocks such as BEFORE ROW
are executed.
When the user clicks on an action view (button), or when an asynchronous event occurs, dialog interaction blocks like ON ACTION
are executed.
The code inside a DISPLAY ARRAY
dialog can use control instructions, dialog control functions, and the ui.Dialog
class, to implement
the dialog behavior.
A DISPLAY ARRAY
dialog is in read-only mode for navigating the list of records
and needs a user action to perform a modification to the record list. An INPUT
ARRAY
dialog offers record list navigation with direct modification; no user action is
required to modify the data.
DISPLAY ARRAY
is better adapted to modern graphical user interfaces, while
INPUT ARRAY
is better adapted to TUI mode ergonomics. It is also easier to program
a DISPLAY ARRAY
with modification triggers compared to the implementation of an
INPUT ARRAY
, especially when the underlying SQL table must be updated during the
dialog execution.
For modern GUI applications, we recommend using DISPLAY ARRAY
with modification
triggers (ON APPEND
, ON INSERT
, ON UPDATE
, ON DELETE
).