Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
jolio007
Contributor
Contributor

Merging multiple tables into one

INPUT DATA: 

 

TABLE 1

ref  CountryA_Quantity CountryA_Sales CountryB_Quantity CountryB_Sales CountryC_Quantity CountryC_Sales
1            
2            
3            
4            
5            

 

TABLE 2

ref  CountryA_Quantity CountryA_Sales
1 50 1000
3 20 15

 

TABLE 3

ref  CountryB_Quantity CountryB_Sales
1 100 84
2 2 4
3 789 6613

 

TABLE 4 

ref  CountryC_Quantity CountryC_Sales
3 50 147
4 75 25
5 25 152

 

OUTPUT DATA

ref  CountryA_Quantity CountryA_Sales CountryB_Quantity CountryB_Sales CountryC_Quantity CountryC_Sales
1 50 1000 100 84    
2     2 4    
3 20 15 789 6613 50 147
4         75 25
5         25 152

 

I really need help with this, if more clarification is necessary, don't hesitate to contact me 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi,

 

    Please refer the below job flow for the resolution.

0683p000009M6FZ.png

 

0683p000009M6Fe.png

 

Now coming to job flow, the first part is to gather the unique ids for the flow. You will have to read data from all three files and then take unique ids after joining using tUnique. If you already have a data set containing unique ids, you can skip this step.

0683p000009M6Fj.png

 

0683p000009M6A1.png

 

0683p000009M6Fo.png

 

The unique ids will be stored in tHashOutput. You can read the data again in next Subjob using tHashInput and then do further processing.

0683p000009M6Fy.png

 

0683p000009M6F1.png

 

You can get the required data by doing Left outer join with three original files.

 

Hope I answered your query. Please spare a second to mark the post as resolved 🙂

 

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

3 Replies
Anonymous
Not applicable

Hi,

 

    Please refer the below job flow for the resolution.

0683p000009M6FZ.png

 

0683p000009M6Fe.png

 

Now coming to job flow, the first part is to gather the unique ids for the flow. You will have to read data from all three files and then take unique ids after joining using tUnique. If you already have a data set containing unique ids, you can skip this step.

0683p000009M6Fj.png

 

0683p000009M6A1.png

 

0683p000009M6Fo.png

 

The unique ids will be stored in tHashOutput. You can read the data again in next Subjob using tHashInput and then do further processing.

0683p000009M6Fy.png

 

0683p000009M6F1.png

 

You can get the required data by doing Left outer join with three original files.

 

Hope I answered your query. Please spare a second to mark the post as resolved 🙂

 

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 🙂

jolio007
Contributor
Contributor
Author

Thank you for your prompt reply ! 
The solution you gave is really good. I did a simplified version of my problem with only 3 column and it works perfectly for that purpose however in my real data each tables have minimum 60 columns with data that can change according to the country. So I can't have 60 x 3 columns as at the end I need to be able to narrow it down back down to only 60 columns.
The more column per country means more column in the final file which isn't what we want. Furthermore, i don't have only 3 countries, i have more than fifty, so i was wondering if you had something more.. dynamic

 

Cheers,

ThWabi
Creator II
Creator II

Hello jolio007,

I setup a little job to show my solution.

 

0683p000009M6Hf.pngThe Job to Join Tables

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

This is the configuration / setup of one of the "country tables". Adapt to your input source as needed.

0683p000009M6Hk.pngInput Config/Setup

 

 

 

 

 

 

Inside the tMap, configure the joins as shown in the next picture. Use left outer join as the Join Model.

0683p000009M6Hp.pngtMap Joining Tables

 

 

 

 

 

 

 

 

 

 

The job generates the following output:

0683p000009M6Hu.pngSample Output

 

 

 

 

 

 

I hope that helps or gives you an idea to build upon.

 

Best regards,

Thomas