Hi everyone,
I have a dataset which I am passing to another procedure using BIND. In that procedure, I need to define a 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 new dataset on new named buffers of the old temp-tables. However, when I access the handle of the named buffer, Progress is telling me that the buffer is not a member of a dataset.
Here are my procedures:
Proc1.p:
proc2.p:
Can someone explain to me why at the end, the
(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.
I have a dataset which I am passing to another procedure using BIND. In that procedure, I need to define a 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 new dataset on new named buffers of the old temp-tables. However, when I access the handle of the named buffer, Progress is telling me that the buffer is not a member of a dataset.
Here are my procedures:
Proc1.p:
Code:
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:
Code:
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.
Last edited: