ON FILL BUFFER block

The ON FILL BUFFER block is used to fill a page of rows into the dynamic array, according to an offset and a number of rows.

The offset can be retrieved with the FGL_DIALOG_GETBUFFERSTART() built-in function and the number of rows to provide is defined by the FGL_DIALOG_GETBUFFERLENGTH() built-in function.

A typical paged display array consists of a scroll cursor providing the list of records to be displayed. Scroll cursors use a static result set. If you want to display fresh data, you can write advanced paged display array instructions by using a scroll cursor providing the primary keys of the reference result set, plus a prepared cursor used to fetch rows on demand in the ON FILL BUFFER clause. In this case, you may need to check if a row still exists when fetching a record with the second cursor.

Before starting a paged display array, you do normally count the total number of rows in the result set (SELECT COUNT(*)) and give this number to the dialog with the COUNT option or the SET_COUNT() function. You can start the dialog with an undefined number of rows by specifying -1. The dialog will continue to ask for rows with ON FILL BUFFER until you provide less rows as expected for the page, or if you reset the total number of rows to a value different from -1 with ui.Dialog.setArrayLength().