Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set context to current date?

Hi
I am trying to set a string context variable to the current date
context.setProperty("run_date", TalendDate.getDate("YYYY-mm-dd"));
System.out.println( context.run_date);
but I get nothing returned?
Help?
Labels (2)
4 Replies
jkrfs
Creator
Creator

why not
context.run_date = TalendDate.getDate("YYYY-mm-dd");
?
or even
context.run_date.equals(TalendDate.getDate("YYYY-mm-dd");
?
Anonymous
Not applicable
Author

Hi,
Nope.
I am trying to set it in a tJava component at the start of the job. I have read other post and it says to use the setproperty function I just can't get it to work.
Thanks in advance for help.
jkrfs
Creator
Creator

Hi,
Yep.
I have multiple jobs right now that I set the current date in the tJava component at the beginning of the flow so that I can use it in later parts of the job.
Have you tried the method I suggested? Because like I said, it works for me.
Infact, I think if you want to format the date it has to be this way:
context.run_date = TalendDate.formatDate("yyyy-MM-dd",TalendDate.getCurrentDate());
Anonymous
Not applicable
Author

Hi,
Thanks that works - Must be a bad Friday for me.