[Stackoverflow] [Progress OpenEdge ABL] Progress OpenEdge XML optional child node

  • Thread starter Thread starter BobNoobGuy
  • Start date Start date
Status
Not open for further replies.
B

BobNoobGuy

Guest
I need a suggestion on how to write the following XML using write-xml? is this possible? thank you

Notice the last material node has a different elements. How can I made elements optional and "show/notShow" when writing the output?

Code:
def temp-table ttMaterials no-undo       serialize-name "Materials" 
  field MatsID                  as int   serialize-hidden.

def temp-table ttMaterial  no-undo       serialize-name "Material" 
  field MatsID                  as int   serialize-hidden
  field MaterialNumber          as char
  field PalletNumber            as char
  field Quantity                as char
  field UnitOfMeasure           as char
  field StorageLocation         as char
  field OperationCode           as char
  field ReasonCode              as char
  field CancellationFlag        as char
  field ItemNo                  as char.
  
def dataset dsMaterial xml-node-name "ns1:Message" for 
  ttMaterials, ttMaterial.
  data-relation Rel1 for ttMaterials, ttMaterial nested relation-fields(MatsID, MatsID).


<?xml version="1.0"?>
<ns1:Message xmlns:ns1="http://google.envelope">
  <Materials>
    <Material>
      <MaterialNumber>00111</MaterialNumber>
      <PalletNumber>1888845001</PalletNumber>
      <Quantity>91.0000000000</Quantity>
      <UnitOfMeasure>PAC</UnitOfMeasure>
      <StorageLocation>700</StorageLocation>
      <OperationCode>101</OperationCode>
      <ReasonCode/>
      <CancellationFlag>false</CancellationFlag>
      <ItemNo>10</ItemNo>
    </Material>
    <Material>
      <MaterialNumber>00112</MaterialNumber>
      <PalletNumber>45828760</PalletNumber>
      <Quantity>58.3100000000</Quantity>
      <UnitOfMeasure>PAC</UnitOfMeasure>
      <StorageLocation>700</StorageLocation>
      <OperationCode>543</OperationCode>
      <ReasonCode/>
      <CancellationFlag>false</CancellationFlag>
      <ItemNo>10</ItemNo>
    </Material>
    <Material>
       <FromMaterialNumber>000000000000063299</FromMaterialNumber>
       <ToMaterialNumber>000000000000063299</ToMaterialNumber>
       <FromPalletNumber>81592826</FromPalletNumber>
       <ToPalletNumber>81592826</ToPalletNumber>
       <Quantity>8</Quantity>
       <UnitOfMeasure>PAC</UnitOfMeasure>
       <FromStorageLocation>300</FromStorageLocation>
       <ToStorageLocation>300</ToStorageLocation>
       <OperationCode>551</OperationCode>
       <ReasonCode>12</ReasonCode>
       <CancellationFlag>false</CancellationFlag>
    </Material>
  </Materials>
</ns1:Message>

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