Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI, I have a Job that runs and grabs the last 7 days of data - emails it to me. When ran in TOS it is corrected. When I create the Bat file and run with Windows Task Scheduler it uses the last day it was ran in Talend as the Current Date and not the actual date ran.
Any suggestions on how to get the CURDATE in the mysql import query to use the actual date the task schedule is running?
I don't see why CurDate in mySQL would be affected by this. Maybe you could show us your code? But this solution will work for you. In a tJava at the beginning of your job, place this code....
globalMap.put("Date", routines.TalendDate.formatDate("yyyy-MM-dd", routines.TalendDate.getCurrentDate()));
This will store a correctly formatted (for mySQL) Date as String in the globalMap. Then in your MySQL query you can use it in the Where Clause like this....
"Select Your, Column, Data From Your.Table Where yourDateColumn < '" +((String)globalMap.get("Date"))+"'"
Hello,
Does your job work perfectly fine when you run your job script .bat file directly in cmd without using Windows Task Scheduler ?
Best regards
Sabrina
cmd does use the actual curdate - so it works through there! How do I get that to run a scheduled basis?
I don't see why CurDate in mySQL would be affected by this. Maybe you could show us your code? But this solution will work for you. In a tJava at the beginning of your job, place this code....
globalMap.put("Date", routines.TalendDate.formatDate("yyyy-MM-dd", routines.TalendDate.getCurrentDate()));
This will store a correctly formatted (for mySQL) Date as String in the globalMap. Then in your MySQL query you can use it in the Where Clause like this....
"Select Your, Column, Data From Your.Table Where yourDateColumn < '" +((String)globalMap.get("Date"))+"'"
My code used CURDATE directly in the sql. By doing the Java date, we are able to fins a solution that works! thank you for your assistance!