Manage batched data in the client
- Last Updated: January 22, 2026
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
To implement data batching in the client code, the client calls the
server-side procedure to retrieve an initial batch of records, specifying the batch size
and the rowRestart value to indicate in which row the
batch should resume. Initially, rowRestart is undefined,
meaning that the batching begins with the first record in the database table.
|
To manage batching, the client iterates through the records retrieved in the
dataset table and when the query reaches the QUERY-OFF-END condition, the client-side OFF-END event handler executes to determine if more data can be retrieved.
If more data can be retrieved, the client again calls fetchOrders.p appending data to the existing dsOrder dataset. This situation is where rowRestart is important. This value is returned from a previous call to
fetchOrders.p and must be used for the next
call to the server. The event handler also checks the LAST-BATCH attribute of the temp-table to determine whether
there is more data to retrieve from the server. If there are no more records to retrieve
from the database table, the FILL operation that executes in the server automatically
sets this attribute in the dataset returned to the client.
Complete client code for managing batching
The following is the complete client code for managing batching.
Associate the OFF-END event handler for the query with
the offEnd internal procedure. Notice the internal
procedure is in the same file and an external procedure is not used. During the
iteration, when the QUERY-OFF-END condition occurs,
this event handler executes. Notice the input for this handler is the dataset.
In the event handler code, check the LAST-BATCH attribute of the ttOrder
temp-table. If the attribute is not TRUE, call fetchOrders() again, passing the value of rowRestart that was returned from the previous call. Specify APPEND for the dataset so that the new batch of records is
added to the existing dataset. After the call returns from fetchOrders() the code must return NO-APPLY. This ensures that the QUERY-OFF-END condition is set back to FALSE and the retrieval of records
continues until all records are retrieved from the server.
|
|
See also
Buffer BATCH-SIZE and LAST-BATCH attributes in Use ProDataSets
Set up an event handler for the OFF-END query event in Use ProDataSets