ForEachInvoiceDelete
Active Member
One of our developers has been messing about for me testing some dynamic dataset stuff and came across something weird.
If you use an input/output dataset handle, when it comes back out on the output, its stripped all the data relations!
I have had a look and i am also stumped! Anyone else came across this or can point me at something silly in the code?
Running an internal procedure to do data relations using an input/output dataset handle. (I sincerely apologize for the craptastic nature of this code, its play around stuff and would never be in production in this state)
If you use an input/output dataset handle, when it comes back out on the output, its stripped all the data relations!
I have had a look and i am also stumped! Anyone else came across this or can point me at something silly in the code?
Running an internal procedure to do data relations using an input/output dataset handle. (I sincerely apologize for the craptastic nature of this code, its play around stuff and would never be in production in this state)
Code:
/* running this internal procedure */
RUN AddRelationnested(INPUT 2,
INPUT 3,
INPUT keyfields,
INPUT-OUTPUT DATASET-HANDLE hResultSet).
hResultSet:write-xml("file", "/home/iSAMS/Dev/CodeJason/TestXML.XML"). /* XML is not nested, cus progress decided that using input-output can strip out data-relations... */
PROCEDURE AddRelationnested:
DEFINE INPUT PARAMETER ipParentbuff AS INT NO-UNDO.
DEFINE INPUT PARAMETER ipChildbuff AS INT NO-UNDO.
DEFINE INPUT PARAMETER ipKeyFields AS CHARACTER NO-UNDO.
DEFINE INPUT-OUTPUT PARAMETER DATASET-HANDLE ophResultSet.
DEFINE VARIABLE PARENT1 AS HANDLE.
DEFINE VARIABLE child AS HANDLE.
DEFINE VARIABLE intcnt AS INTEGER.
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO EXTENT 40.
DO intcnt = 1 TO ophResultSet:NUM-BUFFERS:
hBuffer[intcnt] = ophResultSet:GET-BUFFER-HANDLE(intcnt).
MESSAGE "NAMES" intcnt hBuffer[intcnt]:NAME.
IF hBuffer[intcnt]:NAME = "someparenttable" THEN ASSIGN parent1 = hBuffer[intcnt].
IF hBuffer[intcnt]:NAME = "somechildtable" THEN ASSIGN child = hBuffer[intcnt].
END.
MESSAGE "JASE" "," ipkeyfields "," parent1:name "," child:name VIEW-AS ALERT-BOX.
ophResultSet:ADD-RELATION(parent1,
child,
ipkeyfields,FALSE,TRUE,TRUE,FALSE,FALSE).
// END.
//ophResultSet:NESTED = TRUE.
ophResultSet:write-xml("file", "/home/iSAMS/Dev/CodeJason/TestXMLCRinclude.XML"). /* Here the XML is nested nicely as i hoped */
END PROCEDURE.