Date in string with compare value in Tmap

Four Stars

Date in string with compare value in Tmap

Hello,
I'm looking for an example for use a date in iso format ("yyyy-mm-dd") in String type where
i can compare (Date > "2007-12-31") in an expression output. Could you help me please.
One Star

Re: Date in string with compare value in Tmap

Hello,
See image.

JC
Four Stars

Re: Date in string with compare value in Tmap

Thank you very mutch JC. I was just trying the compareTo method but i've tried this : I considere Var1 is in date type:
Var.Var1.compareTo(20071231) > 0
But i get this message : "Error compareTo(date) => The method compareTo(date) in the type date is not applicable for the arguments (int)
One Star

Re: Date in string with compare value in Tmap

Like I did, you must create a date type variable with the date you want compare to.
The expression for the variable is :
TalendDate.parseDate("yyyy-MM-dd","2007-12-31")
One Star

Re: Date in string with compare value in Tmap

It's because compareTo need a date type as parameter and you give a integer. Thats why, on the image, you see the parse Date function.
Four Stars

Re: Date in string with compare value in Tmap

Ok i understand. I did what you purpose and the result is perfect. Thank you
One Star

Re: Date in string with compare value in Tmap

Hello,
Thanks for posting this.It helped me.
Five Stars

Re: Date in string with compare value in Tmap

I need to fill a time dimension table so i create this job      in the tfilterRow component i would to generate the date < to 2002-12-31 , when i execute this job i have this error: the compareTo (Date) Date type does not apply to the arguments (int) 
please help me