# scheduler error

**URL:** <https://forum.servoy.com/t/scheduler-error/867>\
**Category:** Classic Servoy\
**Created:** [December 17, 2003, 11:51am UTC](https://forum.servoy.com/t/scheduler-error/867 "2003-12-17T11:51:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [December 17, 2003, 11:51am UTC](https://forum.servoy.com/t/scheduler-error/867/1 "2003-12-17T11:51:29Z")

</div>

Executing a **scheduler.addJob(name, datetime, global.method)** does two things:

- the attached global.method gets executed right away;
- an error message is shown (see attachment);

OS X 10.3.1, Sv2.0B4

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [December 19, 2003, 2:43pm UTC](https://forum.servoy.com/t/scheduler-error/867/2 "2003-12-19T14:43:55Z")

</div>

i don’t thing you do this:

scheduler.addJob(name, datetime, global.method)

but you do this:

scheduler.addJob(name, datetime, global.method())

then yes the global method is executed right away.  
And that method doesn’t return a value so the method addJob with a string, date, function params doesn’t work for string,date,NOTHING.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [December 19, 2003, 2:55pm UTC](https://forum.servoy.com/t/scheduler-error/867/3 "2003-12-19T14:55:54Z")

</div>

OK, I understand now. I have to leave the parenthesis away and just did that. It works again but now what about being able to add variables. Do I do that like your reply to my question by adding an array?

Can you give me an example?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [December 19, 2003, 3:17pm UTC](https://forum.servoy.com/t/scheduler-error/867/4 "2003-12-19T15:17:39Z")

</div>

like this should work:

plugins.scheduler.addCronJob(‘20mins’,‘0 0/20 \* \* \* ?’,globalMethod,new Array(‘it2be’,‘marcel’))  
plugins.scheduler.addCronJob(‘23:30’,‘0 30 23 ? \* \*’,globalMethod,dateNow,date5Days,new Array(‘it2be’,‘marcel’))

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [December 19, 2003, 3:30pm UTC](https://forum.servoy.com/t/scheduler-error/867/5 "2003-12-19T15:30:17Z")

</div>

OK got that working for me. And now, how do I get back that array data?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [December 19, 2003, 4:23pm UTC](https://forum.servoy.com/t/scheduler-error/867/6 "2003-12-19T16:23:02Z")

</div>

that global method will be called with that argumetns array.

so in that global method you can do this:

var firstArg = arguments[0];  
var secondArg = arguments[1];

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [December 19, 2003, 6:09pm UTC](https://forum.servoy.com/t/scheduler-error/867/7 "2003-12-19T18:09:22Z")

</div>

ok I understand so instead of global.method(‘it2be’,‘marcel’) I do global.method, new Array(‘it2be’,‘marcel’)…

Thanks Johan and have a nice weekend…[/code]
