Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Henri-Yan
Contributor II
Contributor II

tXMLMap with multiple lookups multiplies all loops. Is there any way to get distinct results ?

Hello, 

I'm kind of struggling because of the the rest endpoint of one of our provider.

It requires multiple loops per item/entity I have to send to them (I've made this with tXMLMap in order to fill each document) :

HenriYan_1-1717154657883.png

I had to make something that looks like a hack to me with the tJavaFlow, to force each result to generate only one document at a time (with the all in one set to "true" in order to get all the loop in one document for each entity)

HenriYan_0-1717154629807.png

I don't know if i'm doing it the right way, but that's the only way I found to make it ALMOST work...

The issue i'm still facing, is that the multiples lookups multiply each other results numbers.

Here's a result test : 

HenriYan_2-1717155108067.png

It should looks like : 

[...] cdc_offer_photos: [
[Object], [Object]
]
},
cdc_service: [
158, 159, 162, 163, 166
],
cdc_region: [
'28-normandie'
],
cdc_department: [
'27-eure'
]
}

 

Once again, I'm not sure that I'm doing it the right way, and I can't believe that there's not a more elegant/simple way to achieve what I want..

I'm spending so much time on this, I'm really close to drop Talend and rebuild all of this way more easily with a nodejs script....

So I'll take with a great pleasure all your advices, thanks in advance !

Labels (3)
1 Solution

Accepted Solutions
Henri-Yan
Contributor II
Contributor II
Author

Thanks for your reply.

I actually already tried with multiple XMLMap, but ended with the same problem or even worse :c

I will eventually try with multiple tAdvancedFileOutputXML but I'm very reticent to make again and again the same scheme click after click, it takes forever.

And I'm trying right now to use DataMapper (that I had never heard of before) according to one suggestion in the thread you linked.

Seems promising, but I can't find how to make the "lookup" in it. I guess I should use "filter" in the loop tab.
Example : "cdc_offer_photo" should loop over it's code filtered by the "fiche" 's code :

HenriYan_0-1717493240068.png

But, how do I link the two fields inside ?
I (a bit randomly) tried this, and wanted to test it :

HenriYan_1-1717494385886.png

 

But now I can't find how to get the output of the hMap :

HenriYan_2-1717494478259.png

"The scheme has no column defined"

 

Thanks

View solution in original post

3 Replies
Shicong_Hong
Support
Support

Hello @Henri-Yan 

Not able to remove the duplicated records on tXMLMap, you can try to use multiple tAdancedFileOutputXML components with 'Append the source xml file' option to generate the xml file, then read the xml file back as a Document and send it to tRestClient. See this related topic.

https://community.qlik.com/t5/Design-and-Development/tXMLMap-and-multiple-loops/td-p/2449871

Regards

Shicong

Henri-Yan
Contributor II
Contributor II
Author

Thanks for your reply.

I actually already tried with multiple XMLMap, but ended with the same problem or even worse :c

I will eventually try with multiple tAdvancedFileOutputXML but I'm very reticent to make again and again the same scheme click after click, it takes forever.

And I'm trying right now to use DataMapper (that I had never heard of before) according to one suggestion in the thread you linked.

Seems promising, but I can't find how to make the "lookup" in it. I guess I should use "filter" in the loop tab.
Example : "cdc_offer_photo" should loop over it's code filtered by the "fiche" 's code :

HenriYan_0-1717493240068.png

But, how do I link the two fields inside ?
I (a bit randomly) tried this, and wanted to test it :

HenriYan_1-1717494385886.png

 

But now I can't find how to get the output of the hMap :

HenriYan_2-1717494478259.png

"The scheme has no column defined"

 

Thanks

Henri-Yan
Contributor II
Contributor II
Author

Nevermind, I finally made it works.

The problem was that the output of the hmap needs to be a string, not a document (as I tried do inject it in a RESTClient component)

 

Thanks