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

How to generate XML containing multiple sequences

I have a positional file that I need to convert to a number of XML files. Unfortunately the XML structure has two, separate, sequences which tAdvancedFileOutputXML cannot support (I can only specify a single looping element).

Example Input
HEADER
000001P123R1
000001P123R2
000001P154
000002P101R1
000002P123R2
000002P1107R1
000002P125R5
TRAILER

Example Output
<Customer>
    <Id>000001<Id>
    <Name>Joe Dance</Name>
    <Products>
        <Id>123</Id>
        <Id>123</Id>
        <Id>154</Id>
    </Products>
    <Rewards>
        <Id>1</Id>
        <Id>2</Id>
    </Rewards>
</Customer>

<Customer>
    <Id>000002<Id>
    <Name>John Smith</name>
    <Products>
        <Id>101</Id>
        <Id>123</Id>
        <Id>120</Id>
        <Id>125</Id>
    </Products>
    <Rewards>
        <Id>1</Id>
        <Id>2</Id>
        <Id>5</Id>
    </Rewards>
</Customer>


Below is a mocked structure of the current job:
0683p000009LuoC.pngExample Job

Two questions:
1. What is the preferred approach ?
2. If I continue with this solution how do I make sure that the 3 inputs on the right wait for the tAdvancedFileOutXML components to finish and how do I trigger them ? I tried a linked set of tWaitForFile but that didn't seem to work as expected.

Labels (3)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Use a onSubjobOk trigger between tFileInputPositional_1 and tFileInputXML_1, then the 2nd subjob will start only after the 1st one have finished.

View solution in original post

2 Replies
TRF
Champion II
Champion II

Use a onSubjobOk trigger between tFileInputPositional_1 and tFileInputXML_1, then the 2nd subjob will start only after the 1st one have finished.

Anonymous
Not applicable
Author

You might want to use a similar solution to the one I have described here but for JSON (https://community.talend.com/t5/Design-and-Development/How-to-Denormalize-a-JSON-source/m-p/26161#U2...). You would use tExtractXMLField components rather than the JSON equivalent (and will need a bit of  XPath knowledge).