Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Collating Results from Multiple REST Calls

In my use case, I have more than one REST endpoint that I am querying for data.

 

REST Endpoint #1

StockAvailable - integer

 

REST Endpoint #2

UnitsSold - integer

GrossRevenue - decimal

 

I'd like to collate these two results into a single row of data:  StockAvailable, UnitsSold, GrossRevenue.


I've tried tUnite, but - even if I put all 3 columns on both inputs in the metadata - I still end up with a 2-row result for each query :

row1: StockAvailable, ___ , ____

row2: ___, UnitsSold, GrossRevenue

 

I've read a few posts indicating that it's just not possible to collate these results. But I wanted to ask here. Is there a way of getting this call down to a single row of collated output?

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    A quick way of doing is as shown below. As a first step, store the data to a Hash output component (tHashOutput) for each REST API call output (You can even use temporary files if you prefer that way). But before writing to this component, add a tMap where you need to add an additional column called sequence to capturing a running integer value.

 

So the flow each output will be,

 

REST Output -> tMap (to add sequence) -> tHashOutput

 

Now, add a On SubJob OK and read both data using two tHashInput Components and join them to a tMap. So one flow will be main and other will be lookup. Since you have same sequence number in both flow, you can use it as key to join these columns (use inner join in your case). Now, you will get the data in single line and you can ignore the dummy sequence column after the join process.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi,

 

    A quick way of doing is as shown below. As a first step, store the data to a Hash output component (tHashOutput) for each REST API call output (You can even use temporary files if you prefer that way). But before writing to this component, add a tMap where you need to add an additional column called sequence to capturing a running integer value.

 

So the flow each output will be,

 

REST Output -> tMap (to add sequence) -> tHashOutput

 

Now, add a On SubJob OK and read both data using two tHashInput Components and join them to a tMap. So one flow will be main and other will be lookup. Since you have same sequence number in both flow, you can use it as key to join these columns (use inner join in your case). Now, you will get the data in single line and you can ignore the dummy sequence column after the join process.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Thank you.