Prodataset

atuldalvi

Member
How do I limit the no of display records in browser using prodataset ?

I want to return and display next available 10 records on click of button.

I am writing program like below but its not completed yet.

Is there any prodataset property or method available to limit the display records in browser ?
Code:
DEFINE TEMP-TABLE tt_procm
  FIELD lice_id LIKE ProcMain.lice_id
  FIELD proc_id LIKE ProcMain.proc_id
  .

DEFINE VARIABLE hObj AS HANDLE NO-UNDO.

DEFINE QUERY q1 FOR ProcMain. 
DEFINE QUERY q2 FOR tt_procm. 

DEFINE BROWSE b1 QUERY q2 DISPLAY tt_procm.lice_id tt_procm.proc_id 
  WITH 10 DOWN TITLE "ProcMain Browse".

DEFINE BUTTON btnNext LABEL "Next".

DEFINE FRAME f1 b1 btnNext
  WITH SIDE-LABELS AT ROW 2 COLUMN 2.

DEFINE DATASET DsProcm FOR tt_procm.
DEFINE DATA-SOURCE DsrProcm FOR QUERY q1.

hObj = DATASET DsProcm:HANDLE.

BUFFER tt_procm:ATTACH-DATA-SOURCE(DATA-SOURCE DsrProcm:HANDLE).

RUN proc_getrecords.

ENABLE b1 btnNext WITH FRAME f1.

/* Button trigger */
ON 'choose':U OF btnNext
DO:
    RETURN.
END.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.

PROCEDURE proc_getrecords:

    DATASET DsProcm:EMPTY-DATASET.
    EMPTY TEMP-TABLE tt_procm.
   
    QUERY q1:QUERY-PREPARE("FOR EACH procmain no-lock").
    hObj:FILL().

    OPEN QUERY q2 FOR EACH tt_procm.

END PROCEDURE.
 
Last edited by a moderator:

RealHeavyDude

Well-Known Member
While there is a batch-size attribute that you can set on the indiviudal buffers of a ProDataSet to limit the number of records fetched by a fill - if you want to implement some batching you need a little bit more than just pressing a button to get the next batch of records automatically.

You need some sort of context management that allows you to reposition the query onto the next record when you want to fetch the next batch.

Heavy Regards, RealHeavyDude.
 
Top