addCronJob error

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

addCronJob error

Postby Morley » Sun Jan 30, 2005 6:20 pm

I've added the following to the solution's startup script:
Code: Select all
// schedule daily update at 12:20am with no expiry
plugins.scheduler.addCronJob('12:20am','0 20 0 ? * ?',globals.dailyUpdate());
I then closed the solution and reopened it. It got the following error message:
Can't find method
com.servoy.r2.plugins.scheduler.SchedulerProvider.js_addCronJob(string,string,undefinded)

The globals method "dailyUpdate()" is clearly present and I'm able to manually trigger it.

If I remove the "addCronJob" instruction from the startup script, close the solution, then re-open it, the error doesn't trigger.

Puzzled.
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada

Postby automazione » Sun Jan 30, 2005 11:20 pm

Try with:

plugins.scheduler.addCronJob('12:20am','0 20 0 ? * ?',dailyUpdate);

as reported in the "move sample" of the scheduler
Enrico Arata
Servoy Italia
automazione
 
Posts: 366
Joined: Thu Apr 24, 2003 11:37 am
Location: Torino, Italy

Postby Morley » Mon Jan 31, 2005 1:47 am

automazione wrote:Try with:

plugins.scheduler.addCronJob('12:20am','0 20 0 ? * ?',dailyUpdate);

as reported in the "move sample" of the scheduler

That seems to catch it. I was caught off guard by the unexpected syntax for calling a global method.

There was also another flaw. Should be:
Code: Select all
plugins.scheduler.addCronJob('12:20am','0 20 0 ? * *',dailyUpdate);

The original called for "no special value" for both day of month and day of week. The revision calls for every day of the week. The docs are "legal" although not as transparent as they could be. :wink:

Thanks. My first Cron seems to be on its way.
Morley Chalmers
7Office Inc.
User avatar
Morley
 
Posts: 891
Joined: Fri Apr 25, 2003 4:54 pm
Location: Toronto, Canada


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests