Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to check the column DATE is between 2017-01-01 and 2017-12-31. If YES, then i should pass the value as 1 to the output field. How can i do this?
When i gave <= and >= in tMAP, its not accepting.
Does this help you?
If so, thank's to mark your case as solved (Kudos also accepted).
Try this:
TalendDate.compareDate(row1.yourDateField, TalendDate.parseDate("yyyy-MM-dd", "2017-01-01"), "yyyy-mm-dd") >= 0 &&
TalendDate.compareDate(row1.yourDateField, TalendDate.parseDate("yyyy-MM-dd", "2017-12-31"), "yyyy-mm-dd") <= 0Hope this helps.
error. Input date field is string. Please suggest
Also, why its very complicated in talend just to compare two date.
The example I gave you works fine for me.
Share your piece of code.
The date comparison is not "complicated" due to Talend but to Java.
OK..
I just changed the field name from your code given and ran.
EncounterActivityDate field seems to be a String but should be a Date.
Have a look to TalendDate.parseDate to convert from String to Date datatype.
Does this help you?
If so, thank's to mark your case as solved (Kudos also accepted).