Dan Packer
Member
Hi - I'm trying to create a dynamic ProDataset from an XSD file, manually populate the tables, and then export the dataset as formatted XML.
The Dataset is created just fine from the XSD file, and I can populate both the root level table and the first level down. When I populate any data a third level into the dataset, the third-level data is NOT exported when I execute hDSET:WRITE-XML.
Sample code is pasted below, and the response is missing two levels of detail (vhPickupType and vhShipper). The full XSD is attached to this post (It's the standard UPS Rate Request). Any advice would be greatly appreciated!
The Result that I have (missing data) is:
The Dataset is created just fine from the XSD file, and I can populate both the root level table and the first level down. When I populate any data a third level into the dataset, the third-level data is NOT exported when I execute hDSET:WRITE-XML.
Sample code is pasted below, and the response is missing two levels of detail (vhPickupType and vhShipper). The full XSD is attached to this post (It's the standard UPS Rate Request). Any advice would be greatly appreciated!
Code:
DEFINE VARIABLE hDSET AS HANDLE NO-UNDO.
DEFINE VARIABLE vhRateRequest AS HANDLE NO-UNDO.
DEFINE VARIABLE vhRequest AS HANDLE NO-UNDO.
DEFINE VARIABLE lReturn AS LOGICAL NO-UNDO.
DEFINE VARIABLE vhTransactionReference AS HANDLE NO-UNDO.
DEFINE VARIABLE vhPickupType AS HANDLE NO-UNDO.
DEFINE VARIABLE vhShipment AS HANDLE NO-UNDO.
DEFINE VARIABLE vhShipper AS HANDLE NO-UNDO.
CREATE DATASET hDSET.
CREATE DATASET vhRateRequest.
lReturn = vhRateRequest:READ-XMLSCHEMA("FILE", "/home/ups/request.xsd", ?, ?, ?).
ASSIGN vhRequest = vhRateRequest:GET-BUFFER-HANDLE("Request").
vhRequest:BUFFER-CREATE().
vhRequest:BUFFER-FIELD("RequestAction"):BUFFER-VALUE = "Create".
ASSIGN vhShipment = vhRateRequest:GET-BUFFER-HANDLE("Shipment").
ASSIGN vhShipper = vhRateRequest:GET-BUFFER-HANDLE("Shipper").
vhShipment:BUFFER-CREATE().
ASSIGN vhShipment:BUFFER-FIELD("Description"):BUFFER-VALUE = "SHIPPER 01".
vhShipper:BUFFER-CREATE().
ASSIGN vhShipper:BUFFER-FIELD("Name"):BUFFER-VALUE = "Test Name".
ASSIGN vhPickupType = vhRateRequest:GET-BUFFER-HANDLE("PickupType").
vhPickupType:BUFFER-CREATE().
vhPickupType:BUFFER-FIELD("Code"):BUFFER-VALUE = 101.
vhPickupType:BUFFER-FIELD("Description"):BUFFER-VALUE = "TEST Description".
lReturn = vhRateRequest:WRITE-XML("FILE", "/home/ups/request.xml",
TRUE, ?, ?, TRUE, TRUE).
message "Return is: " lReturn view-as alert-box.
The Result that I have (missing data) is:
Code:
<?xml version="1.0"?>
<RatingServiceSelectionRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Request>
<RequestAction>Create</RequestAction>
<RequestOption/>
</Request>
<PickupType>
<Code>101</Code>
<Description>TEST Description</Description>
</PickupType>
<Shipment>
<Description>SHIPPER 01</Description>
</Shipment>
</RatingServiceSelectionRequest>