expression filter in tMap

Employee

expression filter in tMap

Hello

 

I am trying build a job where a list of tables names are loaded from a csv file and for each loaded row a tMap component determines which database and schema to redirect.

tmap1.png

 

as you can see, the table names are loaded from the csv file, however the tMap is not performing the re-direction / filtering .

 

 

tmap2.png

 

So inside the tmap, I am trying to say:

 

If Schema equals 'IBCDM' AND Has_PK_Value equals "NO" then select the row which effectively will be the IBCDM output coming out of the tmap.

 

However the tMap component is not filtering the rows that match that condition.

 

I checked the data in the csv file and they do exist and also I debugged the job with tlogrow and I can see the data being loaded.

 

Am I doing something wrong ?

 

PS I also tried the following expressions

 

row11.Schema.equals("IBCDM")  && row11.Has_PK_Value.equals("NO") == 0   This gives syntax error

row11.Schema.equals("IBCDM")  && row11.Has_PK_Value.equals("NO") == true. This still does not filter rows

 

Thanks


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: expression filter in tMap

Set "catch output reject" to true when the filter is on the input (left) side of the tMap to catch the records which don't match with your filter.
Else, on the output side you may have as many output flows as desired with each its proper filter.

TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: expression filter in tMap

Hi,

Try to uncheck the "Catch output reject" option.


TRF
Employee

Re: expression filter in tMap

tried it and still no output....

Community Manager

Re: expression filter in tMap

Set the "Catch output reject" to false. There is no point to this setting since you only have one output. This option will work if you have more than 1 output and all it does is catch the records that were not output by the other output.

 

Edit: I see @TRF posted this.

 

My other guess would be that your expression....

row11.Schema.equals("IBCDM")  && row11.Has_PK_Value.equals("NO") == true

...is failing because of case sensitivity of your data. What does "Has_PK_Value" hold? What does "Schema" hold?

Employee

Re: expression filter in tMap

I tried that but still no output...:-(

Highlighted
Community Manager

Re: expression filter in tMap

Can you copy and paste some of your file data so that we can see?

Employee

Re: expression filter in tMap

RESOLVED !

 

Thanks Guys, looks like the format of my CSV got screwed up somehow and it was not loading the data correctly into the schema.

 

Corrected the data and re-run and now I am able to load the whole file and filter works in the tMap:

 

tmap3.png

 

So one question, if I want to add additional outputs to the tmap that are based on a different conditions, then I will need to set the 'catch output reject' to TRUE for every output ?

 

Thanks

Fifteen Stars TRF
Fifteen Stars

Re: expression filter in tMap

Set "catch output reject" to true when the filter is on the input (left) side of the tMap to catch the records which don't match with your filter.
Else, on the output side you may have as many output flows as desired with each its proper filter.

TRF

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog