Pro Data Sets and the Fill Method - Forum - OpenEdge Development - Progress Community

Pro Data Sets and the Fill Method

 Forum

Pro Data Sets and the Fill Method

This question is not answered

Using the code below, could someone tell me 1.) if it's possible and 2.) how to do it.

What I am trying to do is set the batch-size on a pro data set fill to 1000 records....(total records is ~500K)

Then <do something> with those records and then retrieve the next 1000.

I am getting the first 1000, but in the next interation, it just starts from the beginning.

Thanks, in advance for any and all help....

define Variable cWhereClause as char no-undo.
define variable icnt as inte no-undo.
define variable hTable as handle no-undo.

DEFINE TEMP-TABLE ttCorpa        NO-UNDO LIKE corpa.
DEFINE TEMP-TABLE ttCorpaIMA     NO-UNDO LIKE corpaima.

DEFINE DATA-SOURCE dsCorpa       FOR corpa.
DEFINE DATA-SOURCE dsCorpaIMA    FOR corpaima.

DEFINE DATASET OneTIS_Corpa FOR ttCorpa,ttCorpaIMA
  DATA-RELATION drCorpaIMA  FOR ttCorpa,ttCorpaIMA
RELATION-FIELDS(corpano,corpano)  NESTED.

BUFFER ttCorpa:HANDLE:ATTACH-DATA-SOURCE (DATA-SOURCE dsCorpa:HANDLE).
BUFFER ttCorpaIMA:HANDLE:ATTACH-DATA-SOURCE  (DATA-SOURCE dsCorpaIMA:HANDLE).

ASSIGN hTable = BUFFER ttCorpa:HANDLE.

assign hTable:BATCH-SIZE = 1000.

DATASET OneTIS_Corpa:EMPTY-DATASET().

ASSIGN cWhereClause = SUBSTITUTE("WHERE corpa.type1 = '&1'", 'CDO').

dataset OneTIS_corpa:FILL().
do while hTable:Last-batch = FALSE:
    assign icnt = 0.

    for each ttCorpa:
        icnt = icnt + 1.
        disp icnt ttCorpa.corpano .
    end.
    message icnt view-as alert-box.

    empty temp-table ttCorpa.
    dataset OneTis_Corpa:FILL().

END.

All Replies
  • You need to use RESTART-ROW or RESTART-ROWID as well in order to get successive batches of rows.