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

Output Wrong when compare two dates with string format in Tmap

Hi,

 

Can anyone please advise me below issue? Thanks a lot!  - 

 

My purpose was to compare if "ETD" is later than "ETA Port" in string data type 

I changed my schema to show "string" for two dates, and then I wrote syntax  -  ETD.compareTo(ETA_to_Discharge_Port)>0

I think my syntax is correct to compare two strings (please correct me if I am wrong) and then I got below output which ETD is earlier than ETA Port

0683p000009LxH7.png

Labels (2)
18 Replies
Anonymous
Not applicable
Author

Thanks!

 

After I change my syntax to TalendDate.compareDate(Var.var1,Var.var2)>0 I still get below errors - 

0683p000009Lxaw.png

 

vboppudi
Partner - Creator III
Partner - Creator III

please provide tMap configurations.

 

Regards,

Anonymous
Not applicable
Author

Hi,

 

I filtered out the empty data and I don't have issue for parse date error for now.

but I have other issue - the output I want is data with ETD>ETA 

For now no matter what I change equation I got ETD<ETA (var1 is ETA and var2 is ETD)

0683p000009LxQ9.png

vboppudi
Partner - Creator III
Partner - Creator III

Try the following:

TalendDate.compareDate(Var.ETA_Date,Var.ETD_Date)<0

 @rchinta date1 (Var.ETA_Date)
 @rchinta date2 (Var.ETD_Date)
 @return the result wheather two date is the same, 

if first one less than second one return number -1 (Var.ETA_Date<Var.ETD_Date)

equal's  return number 0  (Var.ETA_Date=Var.ETD_Date)

bigger than return number 1. (Var.ETA_Date>Var.ETD_Date)

Regards,

 

Anonymous
Not applicable
Author

Sorry not understand where I need to change - I think I use same thing you just advised
manodwhb
Champion II
Champion II

@szhou1,you were getting empty value in date coumn,since you were not able to convert.

 

can you cehck with below expressions in Variable.

 

"".equals(row1.EDT) || row1.EDT == null ? "" : TalendDate.parseDate("mm/DD/yyyy",row1.EDT))
"".equals(row1.ETA) || row1.ETA == null ? "" : TalendDate.parseDate("mm/DD/yyyy",row1.ETA))

Anonymous
Not applicable
Author

Hi,

I filtered out empty value but issue is still there -
i.e. when compare 12/31/2017 with 1/4/2018 Talend will show 12/31/2017>1/4/2018
Jesperrekuh
Specialist
Specialist

its NOT TalendDate.parseDate("mm/DD/yyyy",row1.ETA))

 

But "MM/dd/yyyy"  

 

mm=minutes

MM=Month

Anonymous
Not applicable
Author

Hi,

I think I solved this problem. Thanks Guys!