ON FILL BUFFER Clause

 

ON FILL BUFFER clause is activated, when the cursor goes beyond the last line of the currently displayed dynamic array.

 

The clause is used to add rows to a currently displayed program array, basing on the number of rows and array offset .To get the number of rows, use fgl_dialog_getbufferlength(). To get the offset,  use fgl_dialog_getbufferstart().

 

Typically, before an array is displayed, the total number of rows is specified by set_count() or the COUNT option. The program will execute the ON FILL BUFFER clause till the number of rows which is less than expected for the page, is specified, or till the total rows number is set to other then -1 with the ui.Dialog.setArrayLength() method.

 

   DISPLAY ARRAY prog_arr TO srec.* ATTRIBUTES(COUNT=-1)

     ON FILL BUFFER

        LET arr_offs = fgl_dialog_getBufferStart()

        LET arr_length = fgl_dialog_getBufferLength()

        LET row_ix = arr_offs

        FOR i=1 TO arr_length

           FETCH ABSOLUTE row_ix c1 INTO prog_arr[i].*

           IF SQLCA.SQLCODE!=0 THEN

             CALL DIALOG.setArrayLength("srec",row-1)

             EXIT FOR

           END IF

           LET row_ix = row_ix + 1

        END FOR