DataWeave 2を使用してJSONアレイを作成するためのXMLを再帰的に解析する -- mule フィールド と dataweave フィールド と mulesoft フィールド 関連 問題

Recursively parse XML to create JSON array using dataweave 2












0
vote

問題

日本語

データウェーブ2を使用してJSONアレイを作成するために再帰的にXMLを解析しようとしていますが、そうすることができません。

私の入力XMLは以下のものを表しています -

<事前> <コード> <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"> <Header> <MessageId>{8736346D-A766-4BE1-8592-C263A4CC2AB5}</MessageId> <Action>http://schemas.microsoft.com/dynamics/2008/01/services/BomBillsofMaterialsService/read</Action> </Header> <Body> <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"> <BillsOfMaterials xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BillsOfMaterials"> <DocPurpose>Original</DocPurpose> <SenderId>121</SenderId> <BOMVersion class="entity"> <_DocumentHash>5c32768c0e32d542255d67340fda7a9d</_DocumentHash> <Active>Yes</Active> <Approved>Yes</Approved> <Approver>NoUser</Approver> <BOMId>BOM0012610</BOMId> <Construction>No</Construction> <InventDimId>IDM0000001</InventDimId> <ItemId>9641716</ItemId> <ItemIdCommercial/> <Name>Prepress Bundle - Folding Carton</Name> <QBE_AddedByContainer>Yes</QBE_AddedByContainer> <RecId>5637161354</RecId> <RecVersion>1034011536</RecVersion> <BOMTable class="entity"> <Approved>Yes</Approved> <Approver>NoUser</Approver> <BOMId>BOM0012610</BOMId> <CheckBOM>Yes</CheckBOM> <Name>Prepress Bundle - Folding Carton</Name> <RecId>5637160605</RecId> <RecVersion>450200996</RecVersion> <SiteId>2</SiteId> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000031</InventDimId> <ItemId>96AR169X</ItemId> <LineNum>1.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300477</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000031</InventDimId> <InventLocationId>51ST</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213319</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011986</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR060W</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>111111111</RecId> </BOM> <BOM> <LineNum>2.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR158</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>222222</RecId> </BOM> <BOM> <LineNum>3.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR582O</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>333333333</RecId> <BOMTable> <BOMId>BOM0013773</BOMId> <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name> <Approved>Yes</Approved> <BOM> <LineNum>1000.00</LineNum> <BOMType>Item</BOMType> <ItemId>G211249</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>4444444</RecId> </BOM> <BOM> <LineNum>1006.00</LineNum> <BOMType>Item</BOMType> <ItemId>G25583954_46</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>55555555</RecId> </BOM> </BOMTable> <BOMTable> <BOMId>BOM0013773</BOMId> <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name> <Approved>Yes</Approved> <RecId>333333333</RecId> <BOM> <LineNum>1000.00</LineNum> <BOMType>Item</BOMType> <ItemId>G211249</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>66666666</RecId> </BOM> <BOM> <LineNum>1006.00</LineNum> <BOMType>Item</BOMType> <ItemId>G25583954_46</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>77777777777</RecId> </BOM> </BOMTable> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000002</InventDimId> <ItemId>9646095W</ItemId> <LineNum>11.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300487</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000002</InventDimId> <InventLocationId>NOLOC</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213290</RecId> <RecVersion>1</RecVersion> </InventDimBOM> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000002</InventDimId> <ItemId>9648376X</ItemId> <LineNum>12.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300488</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000002</InventDimId> <InventLocationId>NOLOC</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213290</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011638</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9645340X</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>888888888</RecId> </BOM> <BOM> <LineNum>2.00</LineNum> <BOMType>Item</BOMType> <ItemId>9644384Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>9999999999</RecId> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000003</InventDimId> <ItemId>9643908X</ItemId> <LineNum>13.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300489</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000003</InventDimId> <InventLocationId>01</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213291</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011299</BOMId> <Name/> <Approved>Yes</Approved> <RecId>555555555</RecId> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9642737Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>101010101</RecId> </BOM> <BOM> <LineNum>3.00</LineNum> <BOMType>Item</BOMType> <ItemId>9642736Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>1112112112</RecId> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000003</InventDimId> <ItemId>9642837X</ItemId> <LineNum>14.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300490</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000003</InventDimId> <InventLocationId>01</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213291</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011245</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9644384Y</ItemId> <BOMQty>-1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>13131313</RecId> </BOM> </BOMTable> </BOM> </BOMTable> <InventDim class="entity"> <InventDimId>IDM0000001</InventDimId> <InventSiteId>2</InventSiteId> <RecId>5637199988</RecId> <RecVersion>1</RecVersion> </InventDim> </BOMVersion> </BillsOfMaterials> </MessageParts> </Body> </Envelope>

以下のように、すべてのBOMのJSON配列(階層のないフラット構造)を作成したい -

出力 -

<事前> <コード> [ { "id": "5637300477", "productId": "96AR169X", "parentId": null }, { "id": "111111111", "productId": "96AR060W", "parentId" : "BOM011986" }, { "id": "222222", "productId": "96AR158", "parentId" : "BOM011986" }, { "id": "333333333", "productId": "96AR582O", "parentId": "BOM011986" }, { "id": "4444444", "productId": "G211249", "parentId" : "BOM0013773" }, { "id": "55555555", "productId": "G25583954_46", "parentId" : "BOM0013773" }, { "id": "66666666", "productId": "BOM0013773", "parentId" : "BOM0013773" }, { "id": "77777777777", "productId": "G25583954_46", "parentId" : "BOM0013773" }, { "id": "5637300487", "productId": "9646095W", "parentId" : null }, { "id": "5637300488", "productId": "9648376X", "parentId" : null }, . ]

この場合の再帰の使用を把握することはできません。 私はそれが機能的な言語であるので、私はデータベーブ言語にとってかなり新しいものです。私はJava言語に慣れています。

助けを得ています!!!

英語

I am trying to parse an XML recursively to create JSON array using dataweave 2 but I am not able to do so.

My Input XML is given below -

<?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">     <Header>         <MessageId>{8736346D-A766-4BE1-8592-C263A4CC2AB5}</MessageId>         <Action>http://schemas.microsoft.com/dynamics/2008/01/services/BomBillsofMaterialsService/read</Action>     </Header>     <Body>         <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">             <BillsOfMaterials xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BillsOfMaterials">                 <DocPurpose>Original</DocPurpose>                 <SenderId>121</SenderId>                 <BOMVersion class="entity">                     <_DocumentHash>5c32768c0e32d542255d67340fda7a9d</_DocumentHash>                     <Active>Yes</Active>                     <Approved>Yes</Approved>                     <Approver>NoUser</Approver>                     <BOMId>BOM0012610</BOMId>                     <Construction>No</Construction>                     <InventDimId>IDM0000001</InventDimId>                     <ItemId>9641716</ItemId>                     <ItemIdCommercial/>                     <Name>Prepress Bundle - Folding Carton</Name>                     <QBE_AddedByContainer>Yes</QBE_AddedByContainer>                     <RecId>5637161354</RecId>                     <RecVersion>1034011536</RecVersion>                     <BOMTable class="entity">                         <Approved>Yes</Approved>                         <Approver>NoUser</Approver>                         <BOMId>BOM0012610</BOMId>                         <CheckBOM>Yes</CheckBOM>                         <Name>Prepress Bundle - Folding Carton</Name>                         <RecId>5637160605</RecId>                         <RecVersion>450200996</RecVersion>                         <SiteId>2</SiteId>                         <BOM class="entity">                             <BOMConsump>Variable</BOMConsump>                             <BOMId>BOM0012610</BOMId>                             <BOMQty>1.0000</BOMQty>                             <BOMQtySerie>1</BOMQtySerie>                             <BOMType>Item</BOMType>                             <Calculation>Yes</Calculation>                             <EndSchedConsump>No</EndSchedConsump>                             <Formula>Formula0</Formula>                             <InventDimId>IDM0000031</InventDimId>                             <ItemId>96AR169X</ItemId>                             <LineNum>1.0000000000</LineNum>                             <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                             <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                             <RecId>5637300477</RecId>                             <RecVersion>1</RecVersion>                             <RoundUp>No</RoundUp>                             <UnitId>PCS</UnitId>                             <WrkCtrConsumption>false</WrkCtrConsumption>                             <InventDimBOM class="entity">                                 <InventDimId>IDM0000031</InventDimId>                                 <InventLocationId>51ST</InventLocationId>                                 <InventSiteId>2</InventSiteId>                                 <RecId>5637213319</RecId>                                 <RecVersion>1</RecVersion>                             </InventDimBOM>                             <BOMTable>                                 <BOMId>BOM011986</BOMId>                                                                  <Name/>                                 <Approved>Yes</Approved>                                 <BOM>                                     <LineNum>1.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>96AR060W</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>111111111</RecId>                                 </BOM>                                 <BOM>                                     <LineNum>2.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>96AR158</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>222222</RecId>                                 </BOM>                                 <BOM>                                     <LineNum>3.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>96AR582O</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>333333333</RecId>                                     <BOMTable>                                         <BOMId>BOM0013773</BOMId>                                         <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name>                                         <Approved>Yes</Approved>                                                                                  <BOM>                                             <LineNum>1000.00</LineNum>                                             <BOMType>Item</BOMType>                                             <ItemId>G211249</ItemId>                                             <BOMQty>1.00</BOMQty>                                             <OprNum>0</OprNum>                                             <FromDate>1900-01-01</FromDate>                                             <UnitId>PCS</UnitId>                                             <RecId>4444444</RecId>                                         </BOM>                                         <BOM>                                             <LineNum>1006.00</LineNum>                                             <BOMType>Item</BOMType>                                             <ItemId>G25583954_46</ItemId>                                             <BOMQty>1.00</BOMQty>                                             <OprNum>0</OprNum>                                             <FromDate>1900-01-01</FromDate>                                             <UnitId>PCS</UnitId>                                             <RecId>55555555</RecId>                                         </BOM>                                     </BOMTable>                                     <BOMTable>                                         <BOMId>BOM0013773</BOMId>                                         <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name>                                         <Approved>Yes</Approved>                                         <RecId>333333333</RecId>                                         <BOM>                                             <LineNum>1000.00</LineNum>                                             <BOMType>Item</BOMType>                                             <ItemId>G211249</ItemId>                                             <BOMQty>1.00</BOMQty>                                             <OprNum>0</OprNum>                                             <FromDate>1900-01-01</FromDate>                                             <UnitId>PCS</UnitId>                                             <RecId>66666666</RecId>                                         </BOM>                                         <BOM>                                             <LineNum>1006.00</LineNum>                                             <BOMType>Item</BOMType>                                             <ItemId>G25583954_46</ItemId>                                             <BOMQty>1.00</BOMQty>                                             <OprNum>0</OprNum>                                             <FromDate>1900-01-01</FromDate>                                             <UnitId>PCS</UnitId>                                             <RecId>77777777777</RecId>                                         </BOM>                                     </BOMTable>                                 </BOM>                             </BOMTable>                         </BOM>                         <BOM class="entity">                             <BOMConsump>Variable</BOMConsump>                             <BOMId>BOM0012610</BOMId>                             <BOMQty>1.0000</BOMQty>                             <BOMQtySerie>1</BOMQtySerie>                             <BOMType>Item</BOMType>                             <Calculation>Yes</Calculation>                             <EndSchedConsump>No</EndSchedConsump>                             <Formula>Formula0</Formula>                             <InventDimId>IDM0000002</InventDimId>                             <ItemId>9646095W</ItemId>                             <LineNum>11.0000000000</LineNum>                             <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                             <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                             <RecId>5637300487</RecId>                             <RecVersion>1</RecVersion>                             <RoundUp>No</RoundUp>                             <UnitId>PCS</UnitId>                             <WrkCtrConsumption>false</WrkCtrConsumption>                             <InventDimBOM class="entity">                                 <InventDimId>IDM0000002</InventDimId>                                 <InventLocationId>NOLOC</InventLocationId>                                 <InventSiteId>2</InventSiteId>                                 <RecId>5637213290</RecId>                                 <RecVersion>1</RecVersion>                             </InventDimBOM>                         </BOM>                         <BOM class="entity">                             <BOMConsump>Variable</BOMConsump>                             <BOMId>BOM0012610</BOMId>                             <BOMQty>1.0000</BOMQty>                             <BOMQtySerie>1</BOMQtySerie>                             <BOMType>Item</BOMType>                             <Calculation>Yes</Calculation>                             <EndSchedConsump>No</EndSchedConsump>                             <Formula>Formula0</Formula>                             <InventDimId>IDM0000002</InventDimId>                             <ItemId>9648376X</ItemId>                             <LineNum>12.0000000000</LineNum>                             <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                             <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                             <RecId>5637300488</RecId>                             <RecVersion>1</RecVersion>                             <RoundUp>No</RoundUp>                             <UnitId>PCS</UnitId>                             <WrkCtrConsumption>false</WrkCtrConsumption>                             <InventDimBOM class="entity">                                 <InventDimId>IDM0000002</InventDimId>                                 <InventLocationId>NOLOC</InventLocationId>                                 <InventSiteId>2</InventSiteId>                                 <RecId>5637213290</RecId>                                 <RecVersion>1</RecVersion>                             </InventDimBOM>                             <BOMTable>                                 <BOMId>BOM011638</BOMId>                                 <Name/>                                 <Approved>Yes</Approved>                                                                  <BOM>                                     <LineNum>1.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>9645340X</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>888888888</RecId>                                 </BOM>                                 <BOM>                                     <LineNum>2.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>9644384Y</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>9999999999</RecId>                                 </BOM>                             </BOMTable>                         </BOM>                         <BOM class="entity">                             <BOMConsump>Variable</BOMConsump>                             <BOMId>BOM0012610</BOMId>                             <BOMQty>1.0000</BOMQty>                             <BOMQtySerie>1</BOMQtySerie>                             <BOMType>Item</BOMType>                             <Calculation>Yes</Calculation>                             <EndSchedConsump>No</EndSchedConsump>                             <Formula>Formula0</Formula>                             <InventDimId>IDM0000003</InventDimId>                             <ItemId>9643908X</ItemId>                             <LineNum>13.0000000000</LineNum>                             <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                             <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                             <RecId>5637300489</RecId>                             <RecVersion>1</RecVersion>                             <RoundUp>No</RoundUp>                             <UnitId>PCS</UnitId>                             <WrkCtrConsumption>false</WrkCtrConsumption>                             <InventDimBOM class="entity">                                 <InventDimId>IDM0000003</InventDimId>                                 <InventLocationId>01</InventLocationId>                                 <InventSiteId>2</InventSiteId>                                 <RecId>5637213291</RecId>                                 <RecVersion>1</RecVersion>                             </InventDimBOM>                             <BOMTable>                                 <BOMId>BOM011299</BOMId>                                 <Name/>                                 <Approved>Yes</Approved>                                 <RecId>555555555</RecId>                                 <BOM>                                     <LineNum>1.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>9642737Y</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>101010101</RecId>                                 </BOM>                                 <BOM>                                     <LineNum>3.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>9642736Y</ItemId>                                     <BOMQty>1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>1112112112</RecId>                                 </BOM>                             </BOMTable>                         </BOM>                         <BOM class="entity">                             <BOMConsump>Variable</BOMConsump>                             <BOMId>BOM0012610</BOMId>                             <BOMQty>1.0000</BOMQty>                             <BOMQtySerie>1</BOMQtySerie>                             <BOMType>Item</BOMType>                             <Calculation>Yes</Calculation>                             <EndSchedConsump>No</EndSchedConsump>                             <Formula>Formula0</Formula>                             <InventDimId>IDM0000003</InventDimId>                             <ItemId>9642837X</ItemId>                             <LineNum>14.0000000000</LineNum>                             <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                             <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                             <RecId>5637300490</RecId>                             <RecVersion>1</RecVersion>                             <RoundUp>No</RoundUp>                             <UnitId>PCS</UnitId>                             <WrkCtrConsumption>false</WrkCtrConsumption>                             <InventDimBOM class="entity">                                 <InventDimId>IDM0000003</InventDimId>                                 <InventLocationId>01</InventLocationId>                                 <InventSiteId>2</InventSiteId>                                 <RecId>5637213291</RecId>                                 <RecVersion>1</RecVersion>                             </InventDimBOM>                             <BOMTable>                                 <BOMId>BOM011245</BOMId>                                 <Name/>                                 <Approved>Yes</Approved>                                                                  <BOM>                                     <LineNum>1.00</LineNum>                                     <BOMType>Item</BOMType>                                     <ItemId>9644384Y</ItemId>                                     <BOMQty>-1.00</BOMQty>                                     <OprNum>0</OprNum>                                     <FromDate>1900-01-01</FromDate>                                     <UnitId>PCS</UnitId>                                     <RecId>13131313</RecId>                                 </BOM>                             </BOMTable>                         </BOM>                     </BOMTable>                     <InventDim class="entity">                         <InventDimId>IDM0000001</InventDimId>                         <InventSiteId>2</InventSiteId>                         <RecId>5637199988</RecId>                         <RecVersion>1</RecVersion>                     </InventDim>                 </BOMVersion>             </BillsOfMaterials>         </MessageParts>     </Body> </Envelope>  

I want to create JSON array of all the BOMs (a flat structure with no hierarchy) as shown below -

Output -

 [ {   "id": "5637300477",   "productId": "96AR169X",   "parentId": null      }, {   "id":  "111111111",    "productId":  "96AR060W",    "parentId" : "BOM011986"  }, {   "id":  "222222",    "productId":  "96AR158",    "parentId" : "BOM011986"  }, {   "id": "333333333",   "productId": "96AR582O",   "parentId": "BOM011986"     }, {   "id":  "4444444",    "productId":  "G211249",    "parentId" : "BOM0013773"  }, {   "id":  "55555555",    "productId":  "G25583954_46",    "parentId" : "BOM0013773"  }, {   "id":  "66666666",    "productId":  "BOM0013773",    "parentId" : "BOM0013773"  }, {   "id":  "77777777777",    "productId":  "G25583954_46",    "parentId" : "BOM0013773"  }, {   "id":  "5637300487",    "productId":  "9646095W",    "parentId" : null }, {   "id":  "5637300488",    "productId":  "9648376X",    "parentId" : null  }, .  ] 

I not able to figure it out the use of recursion in this case. I am quite new to Dataweave language as it is functional language. I am used to Java language.

Thanks in advance for help !!!

</div
        
       
       

回答リスト

0
 
vote
vote
ベストアンサー
 

XML文書からすべてのボムテーブルを取得するために、子孫データセレクタ(..を使用)を利用することができ、したがって文書を再帰的にナビゲートする必要はありません。その後、Map / FlatMapを使用して必要なフィールドを出力します。

下記のデータベース:

<事前> <コード> %dw 2.0 output application/json --- payload..*BOMTable flatMap (bomTable) -> bomTable.*BOM map (bomValue) -> { id: bomValue.RecId, productId: bomValue.ItemId, parentId: bomTable.RecId }

出力は次のようになります。

<事前> <コード> [ { "id": "5637300477", "productId": "96AR169X", "parentId": "5637160605" }, { "id": "5637300487", "productId": "9646095W", "parentId": "5637160605" }, { "id": "5637300488", "productId": "9648376X", "parentId": "5637160605" }, { "id": "5637300489", "productId": "9643908X", "parentId": "5637160605" }, { "id": "5637300490", "productId": "9642837X", "parentId": "5637160605" }, { "id": "111111111", "productId": "96AR060W", "parentId": null }, { "id": "222222", "productId": "96AR158", "parentId": null }, { "id": "333333333", "productId": "96AR582O", "parentId": null }, { "id": "4444444", "productId": "G211249", "parentId": null }, { "id": "55555555", "productId": "G25583954_46", "parentId": null }, { "id": "66666666", "productId": "G211249", "parentId": "333333333" }, { "id": "77777777777", "productId": "G25583954_46", "parentId": "333333333" }, { "id": "888888888", "productId": "9645340X", "parentId": null }, { "id": "9999999999", "productId": "9644384Y", "parentId": null }, { "id": "101010101", "productId": "9642737Y", "parentId": "555555555" }, { "id": "1112112112", "productId": "9642736Y", "parentId": "555555555" }, { "id": "13131313", "productId": "9644384Y", "parentId": null } ]

出力はまだあなたが私はあなたのコメントの一つに掲載マッピング規則に基づいて間違っていると思うどの掲示することを期待される出力とは異なることに注意ます。

 

You can make use of descendant data selector (using ..) to retrieve all BOMTable from your xml document and thus there is no need to recursively navigate through your document. Then using map/flatMap to output the necessary fields.

Please see below dataweave:

%dw 2.0 output application/json  ---    payload..*BOMTable flatMap (bomTable) -> bomTable.*BOM map (bomValue) ->  {     id: bomValue.RecId,     productId: bomValue.ItemId,     parentId: bomTable.RecId } 

Output will be as follows:

[   {     "id": "5637300477",     "productId": "96AR169X",     "parentId": "5637160605"   },   {     "id": "5637300487",     "productId": "9646095W",     "parentId": "5637160605"   },   {     "id": "5637300488",     "productId": "9648376X",     "parentId": "5637160605"   },   {     "id": "5637300489",     "productId": "9643908X",     "parentId": "5637160605"   },   {     "id": "5637300490",     "productId": "9642837X",     "parentId": "5637160605"   },   {     "id": "111111111",     "productId": "96AR060W",     "parentId": null   },   {     "id": "222222",     "productId": "96AR158",     "parentId": null   },   {     "id": "333333333",     "productId": "96AR582O",     "parentId": null   },   {     "id": "4444444",     "productId": "G211249",     "parentId": null   },   {     "id": "55555555",     "productId": "G25583954_46",     "parentId": null   },   {     "id": "66666666",     "productId": "G211249",     "parentId": "333333333"   },   {     "id": "77777777777",     "productId": "G25583954_46",     "parentId": "333333333"   },   {     "id": "888888888",     "productId": "9645340X",     "parentId": null   },   {     "id": "9999999999",     "productId": "9644384Y",     "parentId": null   },   {     "id": "101010101",     "productId": "9642737Y",     "parentId": "555555555"   },   {     "id": "1112112112",     "productId": "9642736Y",     "parentId": "555555555"   },   {     "id": "13131313",     "productId": "9644384Y",     "parentId": null   } ] 

Note that the output is still different from the expected output that you posted which I think is incorrect based on the mapping rules you posted in one of your comments.

</div
 
 
 
 
0
 
vote

下記のDWL

を試してみてください <事前> <コード> %dw 2.0 output application/json var payload = read('<?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"> <Header> <MessageId>{8736346D-A766-4BE1-8592-C263A4CC2AB5}</MessageId> <Action>http://schemas.microsoft.com/dynamics/2008/01/services/BomBillsofMaterialsService/read</Action> </Header> <Body> <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"> <BillsOfMaterials xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BillsOfMaterials"> <DocPurpose>Original</DocPurpose> <SenderId>121</SenderId> <BOMVersion class="entity"> <_DocumentHash>5c32768c0e32d542255d67340fda7a9d</_DocumentHash> <Active>Yes</Active> <Approved>Yes</Approved> <Approver>NoUser</Approver> <BOMId>BOM0012610</BOMId> <Construction>No</Construction> <InventDimId>IDM0000001</InventDimId> <ItemId>9641716</ItemId> <ItemIdCommercial/> <Name>Prepress Bundle - Folding Carton</Name> <QBE_AddedByContainer>Yes</QBE_AddedByContainer> <RecId>5637161354</RecId> <RecVersion>1034011536</RecVersion> <BOMTable class="entity"> <Approved>Yes</Approved> <Approver>NoUser</Approver> <BOMId>BOM0012610</BOMId> <CheckBOM>Yes</CheckBOM> <Name>Prepress Bundle - Folding Carton</Name> <RecId>5637160605</RecId> <RecVersion>450200996</RecVersion> <SiteId>2</SiteId> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000031</InventDimId> <ItemId>96AR169X</ItemId> <LineNum>1.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300477</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000031</InventDimId> <InventLocationId>51ST</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213319</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011986</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR060W</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>111111111</RecId> </BOM> <BOM> <LineNum>2.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR158</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>222222</RecId> </BOM> <BOM> <LineNum>3.00</LineNum> <BOMType>Item</BOMType> <ItemId>96AR582O</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>333333333</RecId> <BOMTable> <BOMId>BOM0013773</BOMId> <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name> <Approved>Yes</Approved> <BOM> <LineNum>1000.00</LineNum> <BOMType>Item</BOMType> <ItemId>G211249</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>4444444</RecId> </BOM> <BOM> <LineNum>1006.00</LineNum> <BOMType>Item</BOMType> <ItemId>G25583954_46</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>55555555</RecId> </BOM> </BOMTable> <BOMTable> <BOMId>BOM0013773</BOMId> <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name> <Approved>Yes</Approved> <RecId>333333333</RecId> <BOM> <LineNum>1000.00</LineNum> <BOMType>Item</BOMType> <ItemId>G211249</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>66666666</RecId> </BOM> <BOM> <LineNum>1006.00</LineNum> <BOMType>Item</BOMType> <ItemId>G25583954_46</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>77777777777</RecId> </BOM> </BOMTable> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000002</InventDimId> <ItemId>9646095W</ItemId> <LineNum>11.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300487</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000002</InventDimId> <InventLocationId>NOLOC</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213290</RecId> <RecVersion>1</RecVersion> </InventDimBOM> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000002</InventDimId> <ItemId>9648376X</ItemId> <LineNum>12.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300488</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000002</InventDimId> <InventLocationId>NOLOC</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213290</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011638</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9645340X</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>888888888</RecId> </BOM> <BOM> <LineNum>2.00</LineNum> <BOMType>Item</BOMType> <ItemId>9644384Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>9999999999</RecId> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000003</InventDimId> <ItemId>9643908X</ItemId> <LineNum>13.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300489</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000003</InventDimId> <InventLocationId>01</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213291</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011299</BOMId> <Name/> <Approved>Yes</Approved> <RecId>555555555</RecId> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9642737Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>101010101</RecId> </BOM> <BOM> <LineNum>3.00</LineNum> <BOMType>Item</BOMType> <ItemId>9642736Y</ItemId> <BOMQty>1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>1112112112</RecId> </BOM> </BOMTable> </BOM> <BOM class="entity"> <BOMConsump>Variable</BOMConsump> <BOMId>BOM0012610</BOMId> <BOMQty>1.0000</BOMQty> <BOMQtySerie>1</BOMQtySerie> <BOMType>Item</BOMType> <Calculation>Yes</Calculation> <EndSchedConsump>No</EndSchedConsump> <Formula>Formula0</Formula> <InventDimId>IDM0000003</InventDimId> <ItemId>9642837X</ItemId> <LineNum>14.0000000000</LineNum> <ProdFlushingPrincip>Blank</ProdFlushingPrincip> <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed> <RecId>5637300490</RecId> <RecVersion>1</RecVersion> <RoundUp>No</RoundUp> <UnitId>PCS</UnitId> <WrkCtrConsumption>false</WrkCtrConsumption> <InventDimBOM class="entity"> <InventDimId>IDM0000003</InventDimId> <InventLocationId>01</InventLocationId> <InventSiteId>2</InventSiteId> <RecId>5637213291</RecId> <RecVersion>1</RecVersion> </InventDimBOM> <BOMTable> <BOMId>BOM011245</BOMId> <Name/> <Approved>Yes</Approved> <BOM> <LineNum>1.00</LineNum> <BOMType>Item</BOMType> <ItemId>9644384Y</ItemId> <BOMQty>-1.00</BOMQty> <OprNum>0</OprNum> <FromDate>1900-01-01</FromDate> <UnitId>PCS</UnitId> <RecId>13131313</RecId> </BOM> </BOMTable> </BOM> </BOMTable> <InventDim class="entity"> <InventDimId>IDM0000001</InventDimId> <InventSiteId>2</InventSiteId> <RecId>5637199988</RecId> <RecVersion>1</RecVersion> </InventDim> </BOMVersion> </BillsOfMaterials> </MessageParts> </Body> </Envelope>',"application/xml") --- flatten((payload.Envelope.Body.MessageParts.BillsOfMaterials.BOMVersion..*BOMTable map { BOMTable : $.*BOM map (val) -> { "id": val.RecId, "productId": val.ItemId, parentId : $.RecId } }).*BOMTable)

出力は

です <事前> <コード> [ { "id": "5637300477", "productId": "96AR169X", "parentId": "5637160605" }, { "id": "5637300487", "productId": "9646095W", "parentId": "5637160605" }, { "id": "5637300488", "productId": "9648376X", "parentId": "5637160605" }, { "id": "5637300489", "productId": "9643908X", "parentId": "5637160605" }, { "id": "5637300490", "productId": "9642837X", "parentId": "5637160605" }, { "id": "111111111", "productId": "96AR060W", "parentId": null }, { "id": "222222", "productId": "96AR158", "parentId": null }, { "id": "333333333", "productId": "96AR582O", "parentId": null }, { "id": "4444444", "productId": "G211249", "parentId": null }, { "id": "55555555", "productId": "G25583954_46", "parentId": null }, { "id": "66666666", "productId": "G211249", "parentId": "333333333" }, { "id": "77777777777", "productId": "G25583954_46", "parentId": "333333333" }, { "id": "888888888", "productId": "9645340X", "parentId": null }, { "id": "9999999999", "productId": "9644384Y", "parentId": null }, { "id": "101010101", "productId": "9642737Y", "parentId": "555555555" }, { "id": "1112112112", "productId": "9642736Y", "parentId": "555555555" }, { "id": "13131313", "productId": "9644384Y", "parentId": null } ]
 

Can you please try the below dwl

%dw 2.0 output application/json var payload = read('<?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message"> <Header>     <MessageId>{8736346D-A766-4BE1-8592-C263A4CC2AB5}</MessageId>     <Action>http://schemas.microsoft.com/dynamics/2008/01/services/BomBillsofMaterialsService/read</Action> </Header> <Body>     <MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">         <BillsOfMaterials xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/BillsOfMaterials">             <DocPurpose>Original</DocPurpose>             <SenderId>121</SenderId>             <BOMVersion class="entity">                 <_DocumentHash>5c32768c0e32d542255d67340fda7a9d</_DocumentHash>                 <Active>Yes</Active>                 <Approved>Yes</Approved>                 <Approver>NoUser</Approver>                 <BOMId>BOM0012610</BOMId>                 <Construction>No</Construction>                 <InventDimId>IDM0000001</InventDimId>                 <ItemId>9641716</ItemId>                 <ItemIdCommercial/>                 <Name>Prepress Bundle - Folding Carton</Name>                 <QBE_AddedByContainer>Yes</QBE_AddedByContainer>                 <RecId>5637161354</RecId>                 <RecVersion>1034011536</RecVersion>                 <BOMTable class="entity">                     <Approved>Yes</Approved>                     <Approver>NoUser</Approver>                     <BOMId>BOM0012610</BOMId>                     <CheckBOM>Yes</CheckBOM>                     <Name>Prepress Bundle - Folding Carton</Name>                     <RecId>5637160605</RecId>                     <RecVersion>450200996</RecVersion>                     <SiteId>2</SiteId>                     <BOM class="entity">                         <BOMConsump>Variable</BOMConsump>                         <BOMId>BOM0012610</BOMId>                         <BOMQty>1.0000</BOMQty>                         <BOMQtySerie>1</BOMQtySerie>                         <BOMType>Item</BOMType>                         <Calculation>Yes</Calculation>                         <EndSchedConsump>No</EndSchedConsump>                         <Formula>Formula0</Formula>                         <InventDimId>IDM0000031</InventDimId>                         <ItemId>96AR169X</ItemId>                         <LineNum>1.0000000000</LineNum>                         <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                         <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                         <RecId>5637300477</RecId>                         <RecVersion>1</RecVersion>                         <RoundUp>No</RoundUp>                         <UnitId>PCS</UnitId>                         <WrkCtrConsumption>false</WrkCtrConsumption>                         <InventDimBOM class="entity">                             <InventDimId>IDM0000031</InventDimId>                             <InventLocationId>51ST</InventLocationId>                             <InventSiteId>2</InventSiteId>                             <RecId>5637213319</RecId>                             <RecVersion>1</RecVersion>                         </InventDimBOM>                         <BOMTable>                             <BOMId>BOM011986</BOMId>                                                          <Name/>                             <Approved>Yes</Approved>                             <BOM>                                 <LineNum>1.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>96AR060W</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>111111111</RecId>                             </BOM>                             <BOM>                                 <LineNum>2.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>96AR158</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>222222</RecId>                             </BOM>                             <BOM>                                 <LineNum>3.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>96AR582O</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>333333333</RecId>                                 <BOMTable>                                     <BOMId>BOM0013773</BOMId>                                     <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name>                                     <Approved>Yes</Approved>                                                                          <BOM>                                         <LineNum>1000.00</LineNum>                                         <BOMType>Item</BOMType>                                         <ItemId>G211249</ItemId>                                         <BOMQty>1.00</BOMQty>                                         <OprNum>0</OprNum>                                         <FromDate>1900-01-01</FromDate>                                         <UnitId>PCS</UnitId>                                         <RecId>4444444</RecId>                                     </BOM>                                     <BOM>                                         <LineNum>1006.00</LineNum>                                         <BOMType>Item</BOMType>                                         <ItemId>G25583954_46</ItemId>                                         <BOMQty>1.00</BOMQty>                                         <OprNum>0</OprNum>                                         <FromDate>1900-01-01</FromDate>                                         <UnitId>PCS</UnitId>                                         <RecId>55555555</RecId>                                     </BOM>                                 </BOMTable>                                 <BOMTable>                                     <BOMId>BOM0013773</BOMId>                                     <Name>ArtiosCAD 14 A6 Software box (Standard Edition)</Name>                                     <Approved>Yes</Approved>                                     <RecId>333333333</RecId>                                     <BOM>                                         <LineNum>1000.00</LineNum>                                         <BOMType>Item</BOMType>                                         <ItemId>G211249</ItemId>                                         <BOMQty>1.00</BOMQty>                                         <OprNum>0</OprNum>                                         <FromDate>1900-01-01</FromDate>                                         <UnitId>PCS</UnitId>                                         <RecId>66666666</RecId>                                     </BOM>                                     <BOM>                                         <LineNum>1006.00</LineNum>                                         <BOMType>Item</BOMType>                                         <ItemId>G25583954_46</ItemId>                                         <BOMQty>1.00</BOMQty>                                         <OprNum>0</OprNum>                                         <FromDate>1900-01-01</FromDate>                                         <UnitId>PCS</UnitId>                                         <RecId>77777777777</RecId>                                     </BOM>                                 </BOMTable>                             </BOM>                         </BOMTable>                     </BOM>                     <BOM class="entity">                         <BOMConsump>Variable</BOMConsump>                         <BOMId>BOM0012610</BOMId>                         <BOMQty>1.0000</BOMQty>                         <BOMQtySerie>1</BOMQtySerie>                         <BOMType>Item</BOMType>                         <Calculation>Yes</Calculation>                         <EndSchedConsump>No</EndSchedConsump>                         <Formula>Formula0</Formula>                         <InventDimId>IDM0000002</InventDimId>                         <ItemId>9646095W</ItemId>                         <LineNum>11.0000000000</LineNum>                         <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                         <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                         <RecId>5637300487</RecId>                         <RecVersion>1</RecVersion>                         <RoundUp>No</RoundUp>                         <UnitId>PCS</UnitId>                         <WrkCtrConsumption>false</WrkCtrConsumption>                         <InventDimBOM class="entity">                             <InventDimId>IDM0000002</InventDimId>                             <InventLocationId>NOLOC</InventLocationId>                             <InventSiteId>2</InventSiteId>                             <RecId>5637213290</RecId>                             <RecVersion>1</RecVersion>                         </InventDimBOM>                     </BOM>                     <BOM class="entity">                         <BOMConsump>Variable</BOMConsump>                         <BOMId>BOM0012610</BOMId>                         <BOMQty>1.0000</BOMQty>                         <BOMQtySerie>1</BOMQtySerie>                         <BOMType>Item</BOMType>                         <Calculation>Yes</Calculation>                         <EndSchedConsump>No</EndSchedConsump>                         <Formula>Formula0</Formula>                         <InventDimId>IDM0000002</InventDimId>                         <ItemId>9648376X</ItemId>                         <LineNum>12.0000000000</LineNum>                         <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                         <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                         <RecId>5637300488</RecId>                         <RecVersion>1</RecVersion>                         <RoundUp>No</RoundUp>                         <UnitId>PCS</UnitId>                         <WrkCtrConsumption>false</WrkCtrConsumption>                         <InventDimBOM class="entity">                             <InventDimId>IDM0000002</InventDimId>                             <InventLocationId>NOLOC</InventLocationId>                             <InventSiteId>2</InventSiteId>                             <RecId>5637213290</RecId>                             <RecVersion>1</RecVersion>                         </InventDimBOM>                         <BOMTable>                             <BOMId>BOM011638</BOMId>                             <Name/>                             <Approved>Yes</Approved>                                                          <BOM>                                 <LineNum>1.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>9645340X</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>888888888</RecId>                             </BOM>                             <BOM>                                 <LineNum>2.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>9644384Y</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>9999999999</RecId>                             </BOM>                         </BOMTable>                     </BOM>                     <BOM class="entity">                         <BOMConsump>Variable</BOMConsump>                         <BOMId>BOM0012610</BOMId>                         <BOMQty>1.0000</BOMQty>                         <BOMQtySerie>1</BOMQtySerie>                         <BOMType>Item</BOMType>                         <Calculation>Yes</Calculation>                         <EndSchedConsump>No</EndSchedConsump>                         <Formula>Formula0</Formula>                         <InventDimId>IDM0000003</InventDimId>                         <ItemId>9643908X</ItemId>                         <LineNum>13.0000000000</LineNum>                         <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                         <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                         <RecId>5637300489</RecId>                         <RecVersion>1</RecVersion>                         <RoundUp>No</RoundUp>                         <UnitId>PCS</UnitId>                         <WrkCtrConsumption>false</WrkCtrConsumption>                         <InventDimBOM class="entity">                             <InventDimId>IDM0000003</InventDimId>                             <InventLocationId>01</InventLocationId>                             <InventSiteId>2</InventSiteId>                             <RecId>5637213291</RecId>                             <RecVersion>1</RecVersion>                         </InventDimBOM>                         <BOMTable>                             <BOMId>BOM011299</BOMId>                             <Name/>                             <Approved>Yes</Approved>                             <RecId>555555555</RecId>                             <BOM>                                 <LineNum>1.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>9642737Y</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>101010101</RecId>                             </BOM>                             <BOM>                                 <LineNum>3.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>9642736Y</ItemId>                                 <BOMQty>1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>1112112112</RecId>                             </BOM>                         </BOMTable>                     </BOM>                     <BOM class="entity">                         <BOMConsump>Variable</BOMConsump>                         <BOMId>BOM0012610</BOMId>                         <BOMQty>1.0000</BOMQty>                         <BOMQtySerie>1</BOMQtySerie>                         <BOMType>Item</BOMType>                         <Calculation>Yes</Calculation>                         <EndSchedConsump>No</EndSchedConsump>                         <Formula>Formula0</Formula>                         <InventDimId>IDM0000003</InventDimId>                         <ItemId>9642837X</ItemId>                         <LineNum>14.0000000000</LineNum>                         <ProdFlushingPrincip>Blank</ProdFlushingPrincip>                         <ProjSetSubProdToConsumed>No</ProjSetSubProdToConsumed>                         <RecId>5637300490</RecId>                         <RecVersion>1</RecVersion>                         <RoundUp>No</RoundUp>                         <UnitId>PCS</UnitId>                         <WrkCtrConsumption>false</WrkCtrConsumption>                         <InventDimBOM class="entity">                             <InventDimId>IDM0000003</InventDimId>                             <InventLocationId>01</InventLocationId>                             <InventSiteId>2</InventSiteId>                             <RecId>5637213291</RecId>                             <RecVersion>1</RecVersion>                         </InventDimBOM>                         <BOMTable>                             <BOMId>BOM011245</BOMId>                             <Name/>                             <Approved>Yes</Approved>                                                          <BOM>                                 <LineNum>1.00</LineNum>                                 <BOMType>Item</BOMType>                                 <ItemId>9644384Y</ItemId>                                 <BOMQty>-1.00</BOMQty>                                 <OprNum>0</OprNum>                                 <FromDate>1900-01-01</FromDate>                                 <UnitId>PCS</UnitId>                                 <RecId>13131313</RecId>                             </BOM>                         </BOMTable>                     </BOM>                 </BOMTable>                 <InventDim class="entity">                     <InventDimId>IDM0000001</InventDimId>                     <InventSiteId>2</InventSiteId>                     <RecId>5637199988</RecId>                     <RecVersion>1</RecVersion>                 </InventDim>             </BOMVersion>         </BillsOfMaterials>     </MessageParts> </Body> </Envelope>',"application/xml")  --- flatten((payload.Envelope.Body.MessageParts.BillsOfMaterials.BOMVersion..*BOMTable map  {  BOMTable : $.*BOM map (val) -> {     "id": val.RecId,     "productId": val.ItemId,      parentId : $.RecId } }).*BOMTable) 

Output is

[ { "id": "5637300477", "productId": "96AR169X", "parentId": "5637160605" }, { "id": "5637300487", "productId": "9646095W", "parentId": "5637160605" }, { "id": "5637300488", "productId": "9648376X", "parentId": "5637160605" }, { "id": "5637300489", "productId": "9643908X", "parentId": "5637160605" }, { "id": "5637300490", "productId": "9642837X", "parentId": "5637160605" }, { "id": "111111111", "productId": "96AR060W", "parentId": null }, { "id": "222222", "productId": "96AR158", "parentId": null }, { "id": "333333333", "productId": "96AR582O", "parentId": null }, { "id": "4444444", "productId": "G211249", "parentId": null }, { "id": "55555555", "productId": "G25583954_46", "parentId": null }, { "id": "66666666", "productId": "G211249", "parentId": "333333333" }, { "id": "77777777777", "productId": "G25583954_46", "parentId": "333333333" }, { "id": "888888888", "productId": "9645340X", "parentId": null }, { "id": "9999999999", "productId": "9644384Y", "parentId": null }, { "id": "101010101", "productId": "9642737Y", "parentId": "555555555" }, { "id": "1112112112", "productId": "9642736Y", "parentId": "555555555" }, { "id": "13131313", "productId": "9644384Y", "parentId": null } ] 
</div
 
 
 
 

関連する質問

0  みんなに見える特定のAPIインスタンスと引き換えにREST APIを作る方法は?だから彼らは郵便配達または他の道具からそれを呼び出すことができます  ( How to make a rest api in exchange with a specific api instance visible for ever ) 
デザインセンターでは、エンドポイントが異なるAPIを作成し、交換に公開しました。 このAPIを実行し、モック例の代わりに実データを取得するためにモックとは異なる特定のAPIインスタンスを使用しています。 私はどのように私はそれをテストすることができるように私は...

0  Design CenterのHTTP APIとREST APIリソースタイプの違いは何ですか?  ( What is the difference between http api and rest api resource types in design ce ) 
私はHTTP APIとREST APIリソースタイプの違いを見つけようとしていましたが、明確な違いはありません。 HTTP APIを使用する場合、どのようにしてください。ユースケースは本当に感謝されます。 ...

0  Object Storeが共有されていないB / W Muleランタイム  ( Object store not getting shared b w the mule runtimes ) 
私は異なるWindows VMマシンに2つのラブランタイムを作成しました。そしてランタイムマネージャを介してそれらをクラスタ化しました。 insobtStoreを使用してMuleアプリを作成し、trueへの永続化とクラスタに展開します。私は1つのサーバーでオ...

0  MaleSoftデザインセンター(iPass)に依存関係を追加する方法  ( How to add dependencies to mulesoft design center ipass ) 
Googleスプレッドシートコネクタ 1 をマイMableSoftデザインセンターに追加したいiPass)プロジェクト。プラスボタンをクリックしてGoogleスプレッドシートを検索すると、パレットのコネクタが表示されません。添付のスクリーンショットを確認して...

0  ラプト3.8.4 |データウェーブ1.0  ( For loops in mule 3 8 4 dataweave 1 0 ) 
完全な一致がないので、キャッシュからの既存の製品名のリストを持つ文字列比較を実行する必要がありますが、最初に最後の3文字を削除する必要があります。着信ペイロード文字列と、既存のすべての文字列/製品名との比較を行います。 試合が見つかったら、他の変換を行います。...

0  Mule 4 CloudHub USINFファイルコネクタの/ TMPディレクトリから/ tmpディレクトリを書き込みますか?  ( Mule 4 write and read from tmp directory on cloudhub usinf file connector ) 
一時ファイルにCloudHubにデータを格納したい。この/ tmpディレクトリから書き込もうとすることは可能ですか?もしそうなら、誰かが私にどのように教えてもらえますか? ...

0  ビジネスグループへのアクセス権によるMule Mavenプラグインを使用したビジネスグループの障害へのCloudHub展開  ( Cloudhub deployment to business group failure using mule maven plugin due to acc ) 
Mule Maven Pluginを使用してCloud HubのビジネスグループへのMuleアプリケーションを展開しようとしています3.2.7 組織階層はです <前> 果実 | - 通路 | .. | .. | .. | - 短縮 Dillion B...

0  Studio 7からAnypoint Platformに接続しようとするとエラーが発生しました.SSLハンドシェイクに問題がありました  ( Error when trying to connect to anypoint platform from studio 7 there was a pro ) 
Studio 7からAnypointプラットフォームに接続しようとするとエラーが発生しました.SSLハンドシェイクに問題がありました。証明書の取り付けを確認してください SSLハンドシェイクに問題がありました。証明書の取り付けを確認してください。 jav...

0  Dataweaveを使ってMule 4で2 JSONペイロードを組み合わせる方法  ( How to combine 2 json payload in mule 4 using dataweave ) 
2つの異なるフローから、JSON出力ペイロードと共通のキーに基づいてそれらを組み合わせたものを入手しています。キーは動的なので、任意のキーのために機能する汎用データベースを書いてください。 入力1: <事前> <コード> [ { "Custome...

0  ファイルから読む代わりにByteArrayを使用したConfigurationBuilder  ( Configurationbuilder using bytearray instead of reading from file ) 
SpringXmlConfigurationBuilderFactory を使用して ConfigurationBuilder を構築しようとしています。このコードは、リソースを渡すと機能します(場所のあるファイルのようなもの)。ファイルリソースの代わりに...




© 2022 cndgn.com All Rights Reserved. Q&Aハウス 全著作権所有