Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Could someone help me figure out why the Distinct Child Element property on a Simple Loop is not working in this situation..
I have a simple flat file that has IDs and Zipcodes.
id;zipcode 1;44100 1;44200 2;69002 2;56410 2;56100
I want the output to look like:
<Root> <Record> <id>1</id> <Zips> <Zipcode>44100</Zipcode> <Zipcode>44200</Zipcode> </Zips> </Record> <Record> <id>2</id> <Zips> <Zipcode>69002</Zipcode> <Zipcode>56410</Zipcode> <Zipcode>56100</Zipcode> </Zips> </Record> </Root>
However when I use the Distinct Child Element and set it to "id", it only brings back the first ID, number 1. ID #2 is ignored. The result is:
<Root>
<Record>
<id>1</id>
<Zips>
<Zipcode>44100</Zipcode>
<Zipcode>44200</Zipcode>
</Zips>
</Record>
</Root>
Screenshot of the mapping:
It is odd because this Distinct Child Element component works with an XML input, as can be seen in the https://community.talend.com/t5/Design-and-Development/quot-Group-By-quot-in-data-mapper/td-p/177449 But why did the user need to create a 2nd map just to filter get the unique list and why couldn't they have done it in just 1 mapping? Instead they had to create a 2nd mapping just for the Distinct Child Element setting.
Hi,
I found that out here:
https://jira.talendforge.org/browse/TDM-4476
https://jira.talendforge.org/browse/TDM-562
If you input is Map, yes you have to use prefix Map. When it is XML, you can omit it.
Eric
Is it possible this could be a bug? I didn't find anything specifically related in the report issues. This ticket here might be but the thing I'm trying to do a distinct on is not looping itself, it is within a loop.
Hi,
Could you try with:
That looks like it worked!! How did you know to use "Flat:"? Also do you know if I have to use something else if my input is a "Map" (dataflow from within Talend) instead of an input of a CSV? I will be testing this out with Map input soon.
Hi,
I found that out here:
https://jira.talendforge.org/browse/TDM-4476
https://jira.talendforge.org/browse/TDM-562
If you input is Map, yes you have to use prefix Map. When it is XML, you can omit it.
Eric
You are f*kin brilliant. Thank you very much.