Six Stars

expression filter causing issue

Hi, I have to put the following condition in my Tmap ie

when name='ABC' and year=2010 to 2017, then only give o/p. name is coming from Datasource1 and year from Datasource2

 

so in Tmap, I created this expression filter and it doesn't work.

(Datasource1.name=="ABC" && (Datasource2.year >=2010 && Datasource2.year <=2017))

 

What is wrong with it..? Thanks in advance for help!

7 REPLIES
Six Stars

Re: expression filter causing issue


I took 2 excel files and join with tMap using your filter. Its working perfectly there.
File 1 Schema: ID (int), NAME (string)
File 2 Schema: ID (int), Year (int)
 
File1.NAME.equals("ABC") &&  (File2.YEAR >=2010 && File2.YEAR <=2018)

--> '==' operator compares two object references to see whether they refer to the same instance.
--> equals() method compares the characters inside a String object i.e. compare the data.


Hope it helps.


Regards,
Mohit
Six Stars

Re: expression filter causing issue

 

4.pngThanks, I tried using the same logic. and it throws some java error.

Six Stars

Re: expression filter causing issue

No need to use the logic in VAR area. You need to put the filter in tMap Output table area.
Please see the attachment for more details.

Let me know if it helps.


Regards,
Mohit
Six Stars

Re: expression filter causing issue

Hi,

 

I don't put the expression in the VAR area. I put it in expression builder area only. Somehow it threw error. Is this expression working for u..?

Six Stars

Re: expression filter causing issue

Yes, its working in my case.
After applying this code APPLY OK, just run the job. It will give desired result.

There is possibility that your system has more than 1 java versions, so you need to uninstall them, then reinstall which one you needed.


Regards,
Mohit
Six Stars

Re: expression filter causing issue

Hi Mk02,

 

Yes, I do have mutiple java versions. see below. which one should I keep..?

 

14.png

Twelve Stars

Re: expression filter causing issue

I Suggest you to unistall Java 10

Manohar B