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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Pb with date

Hello,
I want to initialize a context value with the current date minus one month. (This context velue is then send to a child job)
I'm a beginner under JAVA so I try in a tJavaFlex the code :
Calendar cal = Calendar.getInstance();
context.setProperty("sdhm",routines.TalendDate.formatDate("yyyyMM",Cal.add (Cal.MONTH, -1)));

There's compilation errors :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Calendar cannot be resolved to a type
Calendar cannot be resolved
Cal cannot be resolved
Cal cannot be resolved
at testoracle7.jobmaitre.jobmaitre.tJavaFlex_1Process(jobmaitre.java:141)
at testoracle7.jobmaitre.jobmaitre.runJob(jobmaitre.java:297)
at testoracle7.jobmaitre.jobmaitre.main(jobmaitre.java:244)
I try then to include this line :
import java.util.Calendar;
but new errors:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "import", assert expected
java.util.Calendar cannot be resolved
Calendar cannot be resolved to a type
Calendar cannot be resolved
Cal cannot be resolved
Cal cannot be resolved
at testoracle7.jobmaitre.jobmaitre.tJavaFlex_1Process(jobmaitre.java:142)
at testoracle7.jobmaitre.jobmaitre.runJob(jobmaitre.java:304)
at testoracle7.jobmaitre.jobmaitre.main(jobmaitre.java:248)
Could you help me please
Gilles
Labels (3)
3 Replies
Anonymous
Not applicable
Author

Hi
Calendar cal = Calendar.getInstance();

Write these code in a routine, then, call this routine in tJavaFlex component.
Best regards
shong
Anonymous
Not applicable
Author

You can also use the tContextLoad component.
Regards,
Anonymous
Not applicable
Author

Hello MHONG and MHIRT,
thanks very much for your help : It's OK

Best regards
Gilles