Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Global variables are available to all jobs and orders running on a JobScheduler.
They can be set in the config/scheduler.
. This page is under construction and will be completed shortly ...xml
configuration file, which is read when JobScheduler is started. Global variables can also be set in a separate configuration file which is referenced from the config/scheduler.xml
file as shown here:
Code Block |
---|
<params>
<param name="global_configuration_params" value="config/scheduler_global_vars.xml"/>
</params>
|
Note that when global variables are set in a file, they will only be read when JobScheduler starts and a restart of JobScheduler will be necessary if these values are to be modified.
It is however also possible to set global variables via the JobScheduler-API and the http://www.sos-berlin.com/doc/en/scheduler.doc/api/Variable_set.xml spooler.variables.set_var()
function.
This method allows global variables to be set without JobSchedulerhaving to be restarted.
The following example shows the creation of global variables:
Code Block |
---|
Code Block |
Example showing the creation of global variables:
function spooler_process()\{
var d1=new Date();
spooler.variables.set_var("DATACENTER","CTMTESTI2");
spooler.variables.set_var("ODAY", d1.getDate() + "");
spooler.variables.set_var("ODAYNAME", d1.getDay() + "");
spooler.variables.set_var("OMONTH", d1.getMonth() + 1 + "");
spooler.variables.set_var("OMONTHNAME", d1.getMonth() + 1 + "");
spooler.variables.set_var("OYEAR", d1.getFullYear() + "");
spooler.variables.set_var("ODATE", d1.getFullYear() + "-" + (d1.getMonth() + 1) + "-" + d1.getDate());
spooler.variables.set_var("ODAT", d1.getFullYear() + (d1.getMonth() + 1) + d1.getDate() + "");
spooler.variables.set_var("OFULLDATE", d1.getFullYear() + "-" + (d1.getMonth() + 1) + "-" + d1.getDate());
spooler_log.info("variable ODAY set");
spooler_log.info(spooler.variables.xml());
return false;
\}
|
Further information:
- Merging_global_variables_into_job/order_parameters
- Substituting_global_variables
- Variable_set - (JS API Reference handbook)