Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am not able to compare 2 date which is retuning string as output in if else statement in tmap.
I tried below 2 expression but it is not working.
1. !(Relational.ISNULL(lnk_AllData.UPDT_DTTM)) && lnk_AllData.CREATED_DTTM <= lnk_AllData.END_DTTM && TalendDate.getCurrentDate() >= lnk_AllData.UPDT_DTTM &&
lnk_AllData.UPDT_DTTM > lnk_AllData.END_DTTM ? "a":"b"
2 . ((TalendDate.compareDate(lnk_AllData.CREATED_DTTM,lnk_AllData.END_DTTM,"yyyy-MM-dd HH:mm:ss")==0 || TalendDate.compareDate(lnk_AllData.CREATED_DTTM,lnk_AllData.END_DTTM,"yyyy-MM-dd HH:mm:ss"==-1)) && (TalendDate.compareDate(TalendDate.getCurrentDate(),lnk_AllData.UPDT_DTTM,"yyyy-MM-dd HH:mm:ss")==0 || TalendDate.compareDate(TalendDate.getCurrentDate(),lnk_AllData.UPDT_DTTM,"yyyy-MM-dd HH:mm:ss" ==1)) && (TalendDate.compareDate(lnk_AllData.UPDT_DTTM,lnk_AllData.END_DTTM),"yyyy-MM-dd HH:mm:ss"==1))?"a":"b"
and all datatype of date columns is date
please help
Hi,
I considered your first expression as the base logic and I have created the job as shown below. Its working for both conditions.
You had specified that your input data is already in date data type. So you do not have to specify date format while doing date comparison. That was the issue in original flow.
!(Relational.ISNULL(row2.UPDT_DTTM)) && TalendDate.compareDate(row2.CREATED_DTTM,row2.END_DTTM)<=0 && TalendDate.compareDate(TalendDate.getCurrentDate(),row2.UPDT_DTTM)>=0 && TalendDate.compareDate(row2.UPDT_DTTM,row2.END_DTTM)>=0 ? "a":"b"
Please spare a second to mark the post as resolved if you are happy 🙂
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂