Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Multiple Loop XML

Hi,
I have a problem when executing the ?tfileoutputmsxml?.
I am trying to fix elements on the xml tree, after the loop element. But when I come back on the xml tree (tfileoutputmsxml) elements have changed place.
When I execute the result is not the one expected. Is there a solution to have this output?
Expected OUTPUT:
<rootTag>
<transaction id="1300400000011">
<retailTransaction>
<lineItem article="1">
<retail discount="20.00"/>
</lineItem>
<lineItem article="2">
<retail discount="30.00"/>
</lineItem>
<lineItem paiement="34224.0"/>
<lineItem paiement="34225.0"/>
<afterLoop1></afterLoop1>
<afterLoop2></afterLoop2>
</retailTransaction>
Regards
Yoann
</transaction>
<transaction id="1300400000012">
<retailTransaction>
<lineItem article="3">
<retail discount="50.00"/>
<retail discount="10.00"/>
</lineItem>
<lineItem paiement="34226.0"/>
<lineItem paiement="34227.0"/>
<lineItem paiement="34228.0"/>
<afterLoop1></afterLoop1>
<afterLoop2></afterLoop2>
</retailTransaction>
</transaction>
</rootTag>
Labels (3)
16 Replies
janhess
Creator II
Creator II

I think the problem may be round the tag lineItem which has different attributes for the 2 loops. I suspect when it is doing the matching to set up the loops, it matches on tag not tag and attribute.
You may need to raise a bug.
Anonymous
Not applicable
Author

With this :
<node componentName="tFileOutputMSXML" componentVersion="0.102" offsetLabelX="0" offsetLabelY="0" posX="736" posY="448">
<elementParameter field="TEXT" name="UNIQUE_NAME" value="tFileOutputMSXML_1"/>
<elementParameter field="FILE" name="FILENAME" value=""C:/Talend/test/outXML.xml""/>
<elementParameter field="TABLE" name="ROOT">
<elementValue elementRef="PATH" value="/rootTag"/>
<elementValue elementRef="COLUMN" value="output1"/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/>
<elementValue elementRef="ORDER" value=""/>
<elementValue elementRef="PATH" value="/rootTag"/>
<elementValue elementRef="COLUMN" value="output3"/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/> <elementValue elementRe

To see the whole post, download it here
OriginalPost.pdf
janhess
Creator II
Creator II

I tried setting up your first loop which gave the following in the .item file for vn 4.0.2
<node componentName="tAdvancedFileOutputXML" componentVersion="0.102" offsetLabelX="0" offsetLabelY="0" posX="1024" posY="352">
<elementParameter field="TEXT" name="UNIQUE_NAME" value="tAdvancedFileOutputXML_1"/>
<elementParameter field="CHECK" name="USESTREAM" value="false"/>
<elementParameter field="TEXT" name="STREAMNAME" value="outputStream"/>
<elementParameter field="FILE" name="FILENAME" value=""C:/TIS_PE_RTX-All-r43696-V4.0.2/workspace/out.xml""/>
<elementParameter field="TABLE" name="ROOT">
<elementValue elementRef="PATH" value="/rootTag"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/>
<elementValue elementRef="ORDER" value="1"/>
</elementParameter>
<elementParameter field="TABLE" name="GROUP">
<elementValue elementRef="PATH" value="/rootTag/transaction"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/>
<elementValue elementRef="ORDER" value="2"/>
<elementValue elementRef="PATH" value="id"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="attri"/>
<elementValue elementRef="ORDER" value="3"/>
<elementValue elementRef="PATH" value="/rootTag/transaction/retailTransaction"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/>
<elementValue elementRef="ORDER" value="4"/>
<elementValue elementRef="PATH" value="/rootTag/transaction/retailTransaction/afterLoop1"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="branch"/>
<elementValue elementRef="ORDER" value="10"/>
<elementValue elementRef="PATH" value="/rootTag/transaction/retailTransaction/afterLoop2"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="branch"/>
<elementValue elementRef="ORDER" value="11"/>
</elementParameter>
<elementParameter field="TABLE" name="LOOP">
<elementValue elementRef="PATH" value="/rootTag/transaction/retailTransaction/lineItem"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="main"/>
<elementValue elementRef="ORDER" value="5"/>
<elementValue elementRef="PATH" value="article"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="attri"/>
<elementValue elementRef="ORDER" value="6"/>
<elementValue elementRef="PATH" value="paiement"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="attri"/>
<elementValue elementRef="ORDER" value="7"/>
<elementValue elementRef="PATH" value="/rootTag/transaction/retailTransaction/lineItem/retail"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="branch"/>
<elementValue elementRef="ORDER" value="8"/>
<elementValue elementRef="PATH" value="discount"/>
<elementValue elementRef="COLUMN" value=""/>
<elementValue elementRef="VALUE" value=""/>
<elementValue elementRef="ATTRIBUTE" value="attri"/>
<elementValue elementRef="ORDER" value="9"/>
</elementParameter>

This has all the correct values in the elementRef="ORDER" so Afterloop1 & 2 have higher values than itemLine.
You could try setting the order values in your .item and see if it then produces the correct results.
Anonymous
Not applicable
Author

No it doesn't change anything ... 0683p000009MPcz.png
janhess
Creator II
Creator II

Which version are you using?
Anonymous
Not applicable
Author

5.0.1
But i did something to correct this stuff, a little code using JDOM to change position of XML node. Not really clean but it works 0683p000009MACn.png
Thanks
Anonymous
Not applicable
Author

I have the same problem and have raised it with support. It seems sometimes the element order is lost on tOutputMSXML. I'm fixing mine with an XSLT transformation.