Talend 5.6.1 Data Services - tXMLMap and multi loops

Hi

i've to create an XML file as a standard defined by Microsoft Dynamics AX 2012.

 

to summarize the structure is:

<Header> .... </Header>

<Body>

   <SalesOrders>                                                  list of many orders

     <SalesTable>                                                  one order

       <DocuRefHeader> ... </DocuRefHeader>    a set of unlimited of this tag may be present at the Header of Sale  Order (Lists of different notes represent by couple (type,text).

       <SalesLines>                                                list of lines in one order

             <LineDocu> ... </LineDocu>                   a set of unlimited of this tag may be present on different lines (Lists of different notes represent by couple (type,text).

       </SalesLine>

     </SalesTable>

   <SalesOrders>

 

i've 5 Excel files in entry, one for Header, one for DocuRefHeader attach on Header, one for lines, one for LineDocu attach on Lines (the 5th is for delivery adress, but not cause of problem).

 

i've design my job like this

2017-06-19_154627.png

the tMap aggregate all datas with the good id (Sales Order ID or Sales Lines ID). So if for one Sales Order i've 3 DocuRef, i 'll have 3 lines in the output flow.

 

the tXMLMap realize the mapping, with option "All in one" true and "create empty element" false

the tFileOutputXML write the document generated by tXMLMap as an XML file

 

My problem: it's write only if i've one DocRefHeader or one LineDocu. How could i've loop on this 2 parts ?

i've try to use the 2 excel  files with note as lookup of the tXMLMap without success

i've try to use tFileOutputMSXML but it's complex and create some others problems (some part of XML has an identification "entity" that must to be generate only if one other tag is not empy ...)

 

thanks for your help, i'm searching since one week without success.

  • Data Integration