Five Stars

Compare one date with another specific date in Tmap

Hi,

 

I need to compare one date with 5/1/2018 so I create two local variables and then use compareDate but it doesn't work -  V2 can not be resolved as a variable.

Please advise me. Thank you!

 

V1:      TalendDate.parseDate("MM/dd/yyyy",row1.ETD) 

V2:      TalendDate.parseDate("MM/dd/yyyy","05-01-2018") 

 

Output:    V1.compareDate(V2)>=0

 

8 REPLIES
Forteen Stars TRF
Forteen Stars

Re: Compare one date with another specific date in Tmap

Have a look to document for TalendDate routines.

https://help.talend.com/reader/_Qg2guINsDl6hsiB7uKWzQ/FbEV9SOAKgdqROp7dcKOQw


TRF
Nine Stars

Re: Compare one date with another specific date in Tmap

If you created variables in tMap then you have to refer variable with prefix Var.V1 or Var.V2.

Var.V1.compareDate(Var.V2)>=0

Regards,

Veeru Boppudi
Five Stars

Re: Compare one date with another specific date in Tmap

Hi,

 

Thanks for your advise.

After I added Var. I still got error which showed "The method compareDate(Date) is undefined for the type date". I checked I changed data type to "Date" for variables

Nine Stars

Re: Compare one date with another specific date in Tmap

is it possible to provide screen shot of job and tMap configuration?

 

Regards,

Veeru Boppudi
Five Stars

Re: Compare one date with another specific date in Tmap

Capture.PNG

Capture.PNG

Please see above

Nine Stars

Re: Compare one date with another specific date in Tmap

try this TalendDate.compareDate(Var.ETDate,Var.D0501)>=0

 

Regards,

Veeru Boppudi
Five Stars

Re: Compare one date with another specific date in Tmap

After I run with "TalendDate.compareDate(Var.ETDate,Var.D0501)>=0" I got below error info -
Capture.PNG

Forteen Stars TRF
Forteen Stars

Re: Compare one date with another specific date in Tmap