[resolved] tFilterRow - can not filter on dates

One Star

[resolved] tFilterRow - can not filter on dates

Hi there,
Trying to filter on a date column in v.3.2.1 but it fails with error
-- The method compareTo(Date) in the type Date is not applicable for the arguments (int)

These are my comparasions
sl_date >= 01/01/2004
sl_date <= 01/31/2004
date format is "MM/dd/yyyy".

Accepted Solutions
Community Manager

Re: [resolved] tFilterRow - can not filter on dates

Hello
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002"))

but I got error message
Syntax Error on token "&&", Expression expected after job ImportSalesData

The correct expression is:
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002")

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Four Stars

Re: [resolved] tFilterRow - can not filter on dates

Hello,
Instead of 01/01/2004 String for your comparaison, can you try with TalendDate.parseDate("MM/dd/yyyy","01/01/2004")) ?
Regards,
SeB
One Star

Re: [resolved] tFilterRow - can not filter on dates

Hello,
Instead of 01/01/2004 String for your comparaison, can you try with ?
Regards,
SeB

Hi samlleret, thank for reply.
I did put TalendDate.parseDate("MM/dd/yyyy","01/01/2004")) in Value field so my filter looks like this now
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002"))

but I got error message
Syntax Error on token "&&", Expression expected after job ImportSalesData
Community Manager

Re: [resolved] tFilterRow - can not filter on dates

Hello
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002"))

but I got error message
Syntax Error on token "&&", Expression expected after job ImportSalesData

The correct expression is:
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002")

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: [resolved] tFilterRow - can not filter on dates

Thank shong and sorry for my mistake in my copy and paste ;-)
One Star

Re: [resolved] tFilterRow - can not filter on dates

Well, I am getting error on tInformixInput now.
-- SQLException: Unable to build a date Object based on localized date stream representation.
I derived schema out of real table and I am not sure why it fails. "Date Pattern" "MM/dd/yyyy" was default one chosen by schema builder.
One Star

Re: [resolved] tFilterRow - can not filter on dates

After fixing schema issues this line worked just fine
sl_date <= TalendDate.parseDate("MM/dd/yyyy","01/01/2002")

Thanks
One Star

Re: [resolved] tFilterRow - can not filter on dates

I have tried below formula in tMAP, but get an expression error message.
row1.DATUM >= TalendDate.parseDate("yyyy-MM-dd","2010-01-01")
What might cause the error?
Four Stars

Re: [resolved] tFilterRow - can not filter on dates

What is datatype of row1.DATUM?
You can't compare date like this in talend....
Check following post
http://www.talendforge.org/forum/viewtopic.php?id=33910
Vaibhav