Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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 🙂
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 🙂
Thank you.