Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
Labels (2)
7 Replies
Anonymous
Not applicable
Author

Hello,
See image.

JC
0683p000009MCa7.jpg
Anonymous
Not applicable
Author

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)
Anonymous
Not applicable
Author

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")
Anonymous
Not applicable
Author

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.
Anonymous
Not applicable
Author

Ok i understand. I did what you purpose and the result is perfect. Thank you
_AnonymousUser
Specialist III
Specialist III

Hello,
Thanks for posting this.It helped me.
Anonymous
Not applicable
Author

I need to fill a time dimension table so i create this job       0683p000009MCPe.jpg 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