tMap lookup from multiple tables based on condition

One Star

tMap lookup from multiple tables based on condition

Hi,
Is there a way to look up from different tables based on the value of a particular input? 
In my scenario I have to look up (join) from two tables. But the look up should be based on the value of the input (for example if input_table.attribute1==true then look up from table A else look up from table B). Is there a way in Talend Open Studio for Data Integration to achieve this?
Thanks and Regards,
Asanka. 
One Star

Re: tMap lookup from multiple tables based on condition

Hi Asanka,
Interesting problem. Smiley Happy
I could not find a single component which facilitates conditional switching between flow, so had to use another approach.
I used a tHashOutput to save the rows from the main file,
Then create subjobs where the lookup takes place from the different source,
And, connect the subjobs from the main flow with "Run If" conditions 
input_table.attribute1==true

Find below the screen-shot.
I used 3 csv files, instead of DB tables.

Hope this helps. Smiley Happy
MathurM
Seventeen Stars

Re: tMap lookup from multiple tables based on condition

hi,
add filters in lookup join  : one for true value that catch value in first lookup, and second filter in another tMap catch when is false.
the tips is to check if your value is null after the first tMap (because the filter condition true/false ... or because catch nothing).
I'm a little confused I guess Smiley Happy


when true catch value from lookup1 when false catch value from lookup 2

Starting job multilookup at 15:55 28/11/2014.
connecting to socket on port 3610
connected
.------------------.
|  #1. tLogRow_1   |
+-------+----------+
| key   | value    |
+-------+----------+
| id    | 1        |
| value | lookup 1 |
+-------+----------+
disconnected
Job multilookup ended at 15:55 28/11/2014.

hope it helps
regards
laurent
One Star

Re: tMap lookup from multiple tables based on condition

Hi laurent and MathurM,
Thank you very much for your replies on my issue. 
I can't use the laurent mentioned option as I'm using Talend Open Studio for Data Integration (it doesn't support tHash components). 
As a workaround I did it in tow steps and accomplished my goal.
Thanks and Regards,
Asanka.   
Seventeen Stars

Re: tMap lookup from multiple tables based on condition

great Smiley Wink
I guess that tHash are also in Open Studio but perhaps hidden ones.
Have a look a project setting  & palette setting. If they are on the left side, push them on the right side -those that are available in the palette .

regards
laurent
One Star

Re: tMap lookup from multiple tables based on condition

Hi laurent,
Thank you very much for your reply. As you mentioned those components were in hide section. 
One small thing to verify; is it possible to use tHashInput with the large input data set (around 10 million input records)?
In the meantime in my scenario I have to filter input data into two flows based on the value of a particular input column. As laurent suggested I used tHashOutput after the tOracleInput. Then split the tHashOutput into two Run if conditions. But when I run the job noticed that all the records flow only one path even the condition for that path is not true. What would be the reason for that? Please refer the below given image (the top flow will run if new_input.column1==true else the second flow will run).
 

Thanks and Regards,
Asanka.