Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
Hi,
Here is a suggestion:
1- Add an index in your input file:
2-Map it to your XML output (For every entry records)
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):
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
Does it meet your requirements ?
Regards.
Eric
Hi,
Could you upload your map and a test input file ?
Eric
Attached is the mapper along with the test data
Hi,
According to which input field to you want to sort your output ? id2 ? Index line number ? Other ?
Eric
Hi,
Here is a suggestion:
1- Add an index in your input file:
2-Map it to your XML output (For every entry records)
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):
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
Does it meet your requirements ?
Regards.
Eric
Hi Eric - sorry was out sick.
Will try your suggested solution and let you know the out come. Thanks for your help
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