Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am trying to do the incremental load of XML files. I do have date column on yyyy-MM-dd HH:mm:ss which is row2.updatedtimestamp. On first row I am trying to convert my string type data to date format. On the second row I am trying to get the current time.
On the third row I am doing the date differennce with the my date column (row2.updatedtimestamp) with flag.
But the problem is that I am keep getting error as;
Type mismatch: cannot convert from Date to String.
Could you please let me know what is wrong? I also have shared the screenshot of job
Expression | Type | Variable |
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row2.updatedtimestamp ) | Date | format_date |
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",TalendDate.getDate("yyyy-MM-dd HH:mm:ss")) | Date | Current_date |
TalendDate.diffDate(Var.Current_date,Var.format_date,"dd") == 126 ?true:false | Boolean | Out_Flag |
Hi,
What's the complete code executed for the "diff_date" var ??
PS : You can activate the Code Mode to see exactly where is the problem !
Sorry forgot to mention that. That error is at Var.format_date as the code.
And the complete code to date_diff is as;
Proff_tmp.diff_date = TalendDate
.diffDate(Var.Current_date,
Var.format_date, "dd");
Ok i get it !
Change type of your updatetimestamp column to date type !
Good luck
SGV
I tried that. It gives following error.
The method parseDate(String, String) in the type TalendDate is not applicable for the arguments (String, Date)
Hello,
The method TalendDate.parseDate() needs String date not Date date. You can use TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("dd/MM/yyyy")) to achieve your goal.
Best regards
Sabrina
Thanks for the input but that gets me bellow error;
The method formatDate(String, Date) in the type TalendDate is not applicable for the arguments (String)
Hi,
@brawal wrote:
Thanks for the input but that gets me bellow error;
The method formatDate(String, Date) in the type TalendDate is not applicable for the arguments (String)
Would you mind posting your current expression setting screenshot in tMap into forum?
Best regards
Sabrina
I have mentioned on the original post. The expression is as;
Expression | Type | Variable |
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row2.updatedtimestamp ) | Date | format_date |
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",TalendDate.getDate("yyyy-MM-dd HH:mm:ss")) | Date | Current_date |
TalendDate.diffDate(Var.Current_date,Var.format_date,"dd") == 126 ?true:false | Boolean | Out_Flag |
And screenshot;
Please let me know if you are not clear.