Talend join two files by column id and create a new entry

Four Stars

Talend join two files by column id and create a new entry

Hi,

 

this is my first post here in talend community.

 

productsFile:

product_idtarget
Maxplore_4GALL

 

discountsFile:

discount_idproduct_idtarget
Maxplore_4G_2_55000_AMaxplore_4G|1|2|3|4|5|6|7|8|9|10|11|12|
Maxplore_4G_2_55000_BMaxplore_4G|1|2|3|4|5|6|7|8|9|10|11|12|
Maxplore_4G_3_90000_QMaxplore_4G|1|
Maxplore_4G_3_90000_RMaxplore_4GALL

 

Expected Output

product_iddiscount_idtarget
Maxplore_4G ALL
Maxplore_4GMaxplore_4G_2_55000_A|1|2|3|4|5|6|7|8|9|10|11|12|
Maxplore_4GMaxplore_4G_2_55000_B|1|2|3|4|5|6|7|8|9|10|11|12|
Maxplore_4GMaxplore_4G_3_90000_Q|1|
Maxplore_4GMaxplore_4G_3_90000_RALL

 

Basically what i want is for each product id in productsFile join discountsFile on discountsFile and also create a new entry without discountId for every distinct productId in productsFile.

 

I was able to do the join using a regular tMap but i have no idea on how to create that empty discountId.

 

Thanks in advance


Accepted Solutions
Nine Stars

Re: Talend join two files by column id and create a new entry

HI Are you looking for the following output?

Products.PNG

tMap used to join product and discount files to get only discounts available in product table and by using unite union the data product and discounts.

 

Regards,

Veeru Boppudi

All Replies
Nine Stars

Re: Talend join two files by column id and create a new entry

HI Are you looking for the following output?

Products.PNG

tMap used to join product and discount files to get only discounts available in product table and by using unite union the data product and discounts.

 

Regards,

Veeru Boppudi
Four Stars

Re: Talend join two files by column id and create a new entry

It's almost there Smiley Happy

The flow should work based on productId from productsFile.

so for each productId in productsFile we need to go find a match in discountsFile , not the other way.

 

I managed to fix the issue by changing you solution

 

Capture1.PNGCapture2.PNG