Hello
I am trying to have my context provide a dynamic value (a date in my case).
So in my context, I have an OPEN_DATE key, with the following value: TalendDate.formatDate("yyyy-MM-dd",TalendDate.addDate(TalendDate.getCurrentDate(),-1,"dd"))
But the property's value in my job is literally that string, and not yesterday's date.
I would like to do such a thing to keep a hand on changing that date without having to open up and modify my job.
Any options?
Thanks.
Fred
Dear Fred
If you want a Date type, don't format it to String, use the following expression should be ok:
TalendDate.addDate(TalendDate.getCurrentDate(),-1,"dd")
If you want a String type, just did as you done:
TalendDate.formatDate("yyyy-MM-dd",TalendDate.addDate(TalendDate.getCurrentDate(),-1,"dd"))
Best regards
Shong
Hi Shong
This is not the problem. Having a String is what I want.
Question is, I have a global context set for my jobs. In this case, I don't want to hardcode a date. So in the context value for key OPEN_DATE, I put a talend expression instead of a literal.
But when that context value is processed, the actual talend expression is not interpolated and I end up with the actual talend expression literal in my job.
Am I making sense?
Thank you.
fred
Hi
Set the context value on tJava at the beginning of job, for example:
tJava
|
onsujobok
|
do other processing
on tJava:
context.varName=TalendDate.formatDate("yyyy-MM-dd",TalendDate.addDate(TalendDate.getCurrentDate(),-1,"dd"));
Best regards
Shong
My point is to have that outside the actual job, so that I could change the date at will, without opening the job (in case of manual rerun for example). So I am guessing this is not possible or? Feature request?