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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] compareDate does not work at all

Hi,
I'm having some issues with the TalendDate.compareDate component.
I have 3 dates:
mainDate (coming from 1 flow)
date1 and date2 coming from another.
mainDate is entering a tMap from the main flow, the others date from a lookup one.
I can't match the two flows using a join, because I need to get informations based on if the mainDate is between date1 and date2. I need date1 <= mainDate < date2.
So i have my tMap like the image uploaded.
I think that Talend compare first the day, then the months and finally the year, which is an awful way to compare dates.
But maybe this is why there is a pattern, to choose how to compare, plus I saw a bug blog post saying that only the US/ENG format works, so I tried several things:
- Put "yyyy-MM-dd" into the filter, return always false which isn't true because there should have some matches
- Make 3 variables, transforming my dates into a string with the following pattern "yyyy-MM-dd" and then into a date again => Return false every time.
So I will check again to see if I'm not mistaken about the matches that should be here, but in the meantime, if you have some ideas or experienced this before, please help me. 0683p000009M9xp.png
0683p000009MCL8.jpg
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

First of all, it was because of my data, it's 100% normal that I got false everytime, because my dates were in 2014 and my mainDate in 2013. Sorry for that.
However I discover this (which I didn't know and not very clear in the documentation imo):
The pattern that you chose when using compareDate is VERY important:
"dd-MM-yyyy" will compare the day FIRST, with this pattern "05-10-2014 < 10-02-2002" will be true.
"yyyy-MM-dd" works fine to compare dates the usual way.

View solution in original post

1 Reply
Anonymous
Not applicable
Author

First of all, it was because of my data, it's 100% normal that I got false everytime, because my dates were in 2014 and my mainDate in 2013. Sorry for that.
However I discover this (which I didn't know and not very clear in the documentation imo):
The pattern that you chose when using compareDate is VERY important:
"dd-MM-yyyy" will compare the day FIRST, with this pattern "05-10-2014 < 10-02-2002" will be true.
"yyyy-MM-dd" works fine to compare dates the usual way.