DISPLAY ARRAY programming steps
Follow this procedure to use the DISPLAY ARRAY dialog
instruction.
To implement a DISPLAY ARRAY statement:
- Create a form specification file containing a screen array. The screen array identifies the presentation elements to be used by the runtime system to display the rows.
-
Make sure that the program controls interruption handling with
DEFER INTERRUPT, to manage the validation/cancellation of the interactive dialog. -
Define an array of records with the
DEFINEinstruction. The members of the program array must correspond to the elements of the screen array, by number and data types. Static or a dynamic arrays can be used for the full list mode, but the paged mode requires a dynamic array. For new developments, use dynamic arrays in both cases. -
Open and display the form, using
OPEN WINDOW WITH FORMor theOPEN FORM/DISPLAY FORMinstructions. - If you want to use the full list mode, fill the program array with data, typically with a result set cursor, counting the number of program records being filled with retrieved data.
-
Set the
int_flagvariable toFALSE. -
Implement the
DISPLAY ARRAYdialog block. When using a static array, specify the number of rows with theCOUNTattribute in theATTRIBUTESclause, or call theSET_COUNT()function before the dialog block. With dynamic arrays, the number of rows is automatically known by the dialog. Consider using theUNBUFFEREDmode in new developments. -
If you want to use the paged mode,
define the total number of rows with the
COUNTattribute (can be -1 for infinite number of rows), and add theON FILL BUFFERclause that will contain the code to fill the dynamic array with the expected rows fromfgl_dialog_getBufferStart()tofgl_dialog_getBufferLength(). -
If multi-row selection is needed, call
the
ui.Dialog.setSelectionMode()method inBEFORE DISPLAYto enable this mode. -
Inside the
DISPLAY ARRAYblock, control the behavior of the instruction withBEFORE ROW,AFTER ROWandON ACTIONblocks. -
After the interaction statement block, test the
INT_FLAGpredefined variable to check if the dialog was canceled (INT_FLAG=TRUE) or validated (INT_FLAG=FALSE). If theINT_FLAGvariable isTRUE, reset it toFALSEin order not to disturb code that relies on this variable to detect interruption events from the GUI front-end or TUI console. -
If needed, get the current row with the
ARR_CURR()built-in function after dialog execution. During dialog execution, you can also useDIALOG.getCurrentRow().