Five Stars

conditions to filter record

Hello,

 

I have two table, i have already jioned it  on table1.id= table2.id

But now i want record

where  

table1.company_code = table2.company_code

otherwise not

 

So how can i add where condition in talend

 

Please reply.....

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: conditions to filter record

Hi,

It depends on the type of the fields that you are comparing. 

If the type is String you have to compare it using string1.equals(string2) (Although it would be better if you use equalsIgnoreCase in place of equals).

 

If type is Integer then you have to compare them like Integer1 == Integer2.

 

And mutiple conditions you can insert using && or || in the expression filter. 

For e.g.  string1.equals(string2)  &&  Integer1 == Integer2

 

Hope this clears your doubt.

 

 

Best Regards,

Abhishek

 

4 REPLIES
Six Stars

Re: conditions to filter record

Hi Anurag140890,

I depends on how you have joined these two tables. If you have joined them using tMap then its straight forward, you can set the condition in the output expression filter.

I have attached the screenshot for your reference.

 

Best Regards,

Abhishek

Five Stars

Re: conditions to filter record

this is not working...

 

 

In my case i did 

row1.emp_comp_code .equals(row2.comp_code) 

and its working ...why???

 

 

And what if i want to insert more than one condition

Six Stars

Re: conditions to filter record

Hi,

It depends on the type of the fields that you are comparing. 

If the type is String you have to compare it using string1.equals(string2) (Although it would be better if you use equalsIgnoreCase in place of equals).

 

If type is Integer then you have to compare them like Integer1 == Integer2.

 

And mutiple conditions you can insert using && or || in the expression filter. 

For e.g.  string1.equals(string2)  &&  Integer1 == Integer2

 

Hope this clears your doubt.

 

 

Best Regards,

Abhishek

 

Six Stars

Re: conditions to filter record

Hi,

It depends on the type of fields that you are comparing.

If type is String you should compare it using String1.equals(String2) (Better to use equalsIgnoreCase).

If type is Integer you should do it like Integer1 == Integer2.

 

To add multiple conditions in the expression filter you can use && and ||.

For Example - String1.equalsIgnoreCase(String2) && Integer1 == Integer2

 

Hope this answers your question.

 

Best Regards,

Abhishek