Six Stars

How to pass sysdate in context file

Hi all,

 

I have a very simple requirement,I have a job which should take the Current date /Sysdate as a context and run the job.But i have an added requirement that I should be able to Override this value for any manual run or past run.I should be able to achieve this without opening the job.So the only way is the job should be able to take the sysdate from context file in Normal scenarios and should be able to take the date when manually overriden in the context file.

 

So can u please help me how can i pass talend.getcurrentdate function in the context file or just giving sysdate will help this regard.We tried giving the currentdate function in the context group,but it s taking as a string and not parsing the date in the next step.

 

regards,

sowmya.N

3 REPLIES
Twelve Stars

Re: How to pass sysdate in context file

You can do this with a bit of code in a tJava at the beginning of your job. This should work....

if(context.dateNow==null){
	context.dateNow = routines.TalendDate.getCurrentDate();
}

 

Rilhia Solutions
Six Stars

Re: How to pass sysdate in context file

yaa as of now i am doing like this only..wanted to check if any other option is there.

Twelve Stars

Re: How to pass sysdate in context file

I don't understand why you want to do it differently? This solves your problem and is a perfectly acceptable way of doing this. Can you tell me what is wrong with this and maybe I can make another suggestion which might be more suitable? 

Rilhia Solutions