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

THMAP output ordering

We have a requirement to create a complex xml for which we are using THMAP.

In the job we are converting the data to a CSV then from CSV we are creating the xml.0683p000009LsFK.png

 

We are having a problem with the sequence. 

expected output - All elements for set 1 in CSV should come first followed by all elements of Set 2


<FEED>
    <entry 0>
    <entry 2>
    <entry 3>
    <entry 4>
    <entry 5>
    <entry 6>
    <entry 0>
    <entry 2>
    <entry 3>
    <entry 4>
    <entry 5>
    <entry 6>
<\FEED>

But THMAP is generating in below fashion

<FEED>
    <entry 0>

    <entry 0>
    <entry 2>

    <entry 2>
    <entry 3>

    <entry 3>
    <entry 4>

    <entry 4>
    <entry 5>

    <entry 5>
    <entry 6>

    <entry 6> 
<\FEED>

 

Any suggestion to address the sequencing would be helpful.

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

Here is a suggestion:

1- Add an index in your input file:

0683p000009LsK0.png

2-Map it to your XML output (For every entry records)

0683p000009LrvE.png

3-Create a second map from XML to XML format that will sort your "Entry" records (Don't map the index field if you don't want it in the output):

0683p000009Lrv1.png

4-Then call this second map from your first map. To do that, right click on your map and choose 'properties' then enter your second map name in "next map" field

0683p000009LsK1.png

Does it meet your requirements ?

 

Regards.

 

Eric

 

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Hi,

 

Could you upload your map and a test input file ?

 

Eric

Anonymous
Not applicable
Author

Attached is the mapper along with the test data

Anonymous
Not applicable
Author

Please refer to the talend.zip folder
Anonymous
Not applicable
Author

Hi,

 

According to which input field to you want to sort your output ? id2 ? Index line number ? Other ?

 

Eric

Anonymous
Not applicable
Author

Preference is to have the entries appear in the same sequence as they appear in csv.
ID2 would be the 2nd choice.

Regards
Satyakam
Anonymous
Not applicable
Author

Hi,

 

Here is a suggestion:

1- Add an index in your input file:

0683p000009LsK0.png

2-Map it to your XML output (For every entry records)

0683p000009LrvE.png

3-Create a second map from XML to XML format that will sort your "Entry" records (Don't map the index field if you don't want it in the output):

0683p000009Lrv1.png

4-Then call this second map from your first map. To do that, right click on your map and choose 'properties' then enter your second map name in "next map" field

0683p000009LsK1.png

Does it meet your requirements ?

 

Regards.

 

Eric

 

Anonymous
Not applicable
Author

Hi Eric - sorry was out sick.

Will try your suggested solution and let you know the out come. Thanks for your help

Anonymous
Not applicable
Author

Thanks Eric. It worked for me.

Final Resolution : MAP1(having CSV to XML) --> MAP2 (XML to XML) Sort Applied on MAP2 --> File written to drive

Anonymous
Not applicable
Author

Where is the zip file?