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

Talend Data Mapper xml input - looking up values in a separate loop

hi!  I have an xml file similar to the following:

 

<travelData>

  <Profiles>

    <Profile id=1 name="George">

    <Profile id=2 name="Henry">

    <Profile id=3 name="Bob">

    <Profile id=4 name="Eugene">

  <Profiles>

  <travelDetail>

    <travelSegment type="AIR" >

       <Price value="205.55" currency="USD">

       <ProfileReference id = 2/>

       <ProfileReference id=3/>

    </travelSegment>

  </travelDetail>

<travelData>

 

To create my JSON output, I loop over the travelSegments with the profileReferences nested, and build separate transactions for each profile reference like:

"travelData":[

{"type":"AIR",

  "name":"Henry",

  "price":205.55,

  "currency":"USD"

},

{"type":"AIR",

  "name":"Bob",

  "price":205.55,

  "currency":"USD"

}

 

I've got the thmap generating

"travelData":[

{"type":"AIR",

  "profileId":2,

  "price":205.55,

  "currency":"USD"

},

{"type":"AIR",

  "profileId":3,

  "price":205.55,

  "currency":"USD"

}

 

How do I lookup the profile reference id in the Profiles array to get the name corresponding to the profileReference id?  

 

I have tried many things including AgConcatFirstPresentValue, but it always grabs just the first value even if I filter the Profiles loop by the id = ProfileReference (at least for the ids included in the profileReference).  Is there a way to get just the profile with the id in the 2nd loop?

 

thank you!

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

I used a set variable:

0683p000009Lt1D.png

Then I get this variable:

0683p000009LtB9.png

 

I uploaded my map.

 

Let me know if it meets your requirements.

 

Regards.

 

Eric


TRAVEL_MAP.zip

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi,

 

I used a set variable:

0683p000009Lt1D.png

Then I get this variable:

0683p000009LtB9.png

 

I uploaded my map.

 

Let me know if it meets your requirements.

 

Regards.

 

Eric


TRAVEL_MAP.zip
Anonymous
Not applicable
Author

Thank you!  It worked like a charm.