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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 experience this before, please help me. 0683p000009M9xp.png
Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hello,
are you using the compare date function?
Anonymous
Not applicable
Author

If you provide a date as String in the format ddMMyyyy yes indeed Talend compares the String starting with the first char but your idea about the way Talend compares Date objects is - please don't be angry - nonsense.
In a tMap the joins the both objects (main column and lookup column) will be check by the equals method of the objects. The pattern in the schema definition for date types will only be used if you convert the date implicit into a string (e.g. you print it out with tLogRow or you get a string from the source and want have it as Date).
It would be great to see your schema definition and you attempts to join it in the tMap.
Anonymous
Not applicable
Author

Hi bbernard,
It seems you have resolved it in the Forum https://community.talend.com/t5/Design-and-Development/resolved-compareDate-does-not-work-at-all/td-.... Could you please also set the topic as resolved?
Best regards
Sabrina