Methods are provided to set and get the number of rows in a read-only or editable list of records.
When using a static array in DISPLAY ARRAY or INPUT ARRAY, you must specify the actual number of rows with the SET_COUNT() built-in function or with the COUNT dialog attribute. Both of them are only taken into account when the interactive instruction starts.
DEFINE arr ARRAY[100] OF ... ... (fill the array with x rows) CALL set_count(x) DISPLAY ARRAY arr TO sa.* ... END DISPLAY
When using multiple list subdialogs in a DIALOG block, the SET_COUNT() built-in function is unusable, as it defines the total number of rows for all lists. The only way to define the number of rows when using a static array in multiple dialogs is to use the COUNT attribute.
Consider using dynamic arrays instead of static arrays.
DEFINE arr DYNAMIC ARRAY OF ... ... (fill the array with x rows) DISPLAY ARRAY arr TO sa.* ... END DISPLAY
However, special consideration has to be taken when using the paged mode of DISPLAY ARRAY. In this mode, the dynamic array only holds a page of the complete row set shown to the user: In paged mode, you must specify the total number of rows with the ui.Dialog.setArrayLength() method.
To get the current number of rows in a DISPLAY ARRAY or INPUT ARRAY, use either the ui.Dialog.getArrayLength() or the ARR_COUNT() function.
DIALOG ... DISPLAY ARRAY arr1 TO sa1.* ON ACTION check IF DIALOG.getArrayLength("sa2")] > 1 THEN ... END IF END DISPLAY DISPLAY ARRAY arr2 TO sa2.* END DISPLAY END DIALOG
INPUT ARRAY arr FROM sa.* ... END INPUT IF NOT int_flag THEN FOR i=1 TO arr_count() ... END FOR END IF
The ARR_COUNT() function returns the number of rows for the last executed dialog, until a new list dialog is started.