[Stackoverflow] [Progress OpenEdge ABL] Buffer says that it is not part of dataset after being input with BIND

Status
Not open for further replies.
I

Ian Stewart

Guest
I have a dataset which I am passing to another procedure using BIND. In that procedure, I need to define a second dataset on a subset of the first dataset's temp-tables; however, Progress does not let me put the same buffer in two datasets so I must define the second dataset on new named buffers of the old temp-tables. However, when I access the handle of the new named buffer, Progress is telling me that the buffer is not a member of a dataset. (The DATASET attribute of the buffer handle gives ?.)

Here are my procedures:

Proc1.p:

DEFINE TEMP-TABLE ttShifts NO-UNDO
FIELD shiftid AS INT
FIELD emp AS CHAR.

DEFINE TEMP-TABLE ttTasks NO-UNDO
FIELD taskid AS INT
FIELD shiftid AS INT.

DEFINE DATASET dsShifts
FOR ttShifts, ttTasks
DATA-RELATION relTask FOR ttShifts, ttTasks
RELATION-FIELDS(ttShifts.shiftid, ttTasks.shiftid) NESTED.

DEFINE VARIABLE lcJson AS LONGCHAR NO-UNDO.
DEFINE VARIABLE hProc2 AS HANDLE NO-UNDO.

ASSIGN lcJson = '~{"dsShifts":~{"ttShifts":[~{"shiftid":101,"emp":"Stewart","ttTasks":[~{"taskid":333,"shiftid":101}]}]}}'.

DATASET dsShifts:READ-JSON("LONGCHAR", lcJson).

RUN proc2.p PERSISTENT SET hProc2.
RUN bindDsShifts IN hProc2 (INPUT DATASET dsShifts BIND).
RUN runProc IN hProc2.
DELETE PROCEDURE hProc2.


Proc2.p:

DEFINE TEMP-TABLE ttShifts NO-UNDO REFERENCE-ONLY
FIELD shiftid AS INT
FIELD emp AS CHAR.

DEFINE TEMP-TABLE ttTasks NO-UNDO REFERENCE-ONLY
FIELD taskid AS INT
FIELD shiftid AS INT.

DEFINE DATASET dsShiftsExt
REFERENCE-ONLY
FOR ttShifts, ttTasks
DATA-RELATION relTask FOR ttShifts, ttTasks
RELATION-FIELDS(ttShifts.shiftid, ttTasks.shiftid) NESTED.

DEFINE BUFFER bfShifts FOR ttShifts.
DEFINE DATASET dsShifts FOR bfShifts.

PROCEDURE bindDsShifts:
DEFINE INPUT PARAMETER DATASET FOR dsShiftsExt BIND.
END.

PROCEDURE runProc:
DEFINE VARIABLE hDsShifts AS HANDLE NO-UNDO.
DEFINE VARIABLE hBuf AS HANDLE NO-UNDO.
ASSIGN
hDsShifts = DATASET dsShifts:HANDLE
hBuf = hDsShifts:GET-BUFFER-HANDLE (1).
MESSAGE VALID-HANDLE(hBuf:DATASET) VIEW-AS ALERT-BOX.
/* here I expect YES but I see NO */
END.


Can someone explain to me why at the end, the hBuf:DATASET is not a valid handle?

(In my actual code, I am trying to do ATTACH-DATA-SOURCE which fails because the buffer is supposedly not part of a dataset.)

I am running OpenEdge 11.4.

Continue reading...
 
Status
Not open for further replies.
Top