#1 2007-11-15 14:10:24

gcollin
Member
Registered: 1970-01-01
Posts: 15

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

Offline

#2 2007-11-16 07:50:25

shong
Talend team
Registered: 2007-08-29
Posts: 10297
Website

Re: Pb with date

Hi

Calendar cal = Calendar.getInstance();

Write these code in a routine, then, call this routine in tJavaFlex component.

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2007-11-16 20:16:09

mhirt
Talend team
Registered: 2006-09-19
Posts: 1633

Re: Pb with date

You can also use the tContextLoad component.

Regards,

Offline

#4 2007-11-22 11:01:02

gcollin
Member
Registered: 1970-01-01
Posts: 15

Re: Pb with date

Hello MHONG and MHIRT,

thanks very much for your help : It's OK


Best regards

Gilles

Offline

Board footer

Powered by FluxBB