Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
... This page is under construction and will be completed shortly ...
Global Variables
Job and order parameters can be set using global variables. A simple example would be:
Code Block |
---|
<param name="BookingDate" value="\$ODAT">
|
where the global variable $ODAT
represents a date and has been set as described in the How to create global variables page. Substituting a job parameter or order parameter in this way would allow, for example, a booking date to be set for a financial transaction although the transaction is actually processed at a later time.
The following is a more complex example Example showing the substitution of global variables in a job:
No Formatcode |
---|
function spooler_task_before() \{ var paramNamesh1.paramNames = spooler_task.params().names().split( ";" ); for( var i in paramNames ) \{ substituteParams( paramNames[i] ); \} return true; \} |
Code Block |
---|
function substituteParams( paramName ) { |
...
No Format |
---|
var paramValue = spooler_task.params().value( paramName ); if(paramValue.search(/\$/) > -1) \{ var schedulerParamNames schedulerParamNamesh1.= spooler.variables().names().split( ";" ); for( var i in schedulerParamNames ) \{ if(paramValue.search(/\$/) == -1) \{ break; \} var schedulerParamValue schedulerParamValueh1.= spooler.variables().value( schedulerParamNames[i] ); spooler_log.info( "Substitute: " + paramName + "=" + paramValue + " with " + schedulerParamNames[i] +h1. "=" + schedulerParamValue ); var pattern = new RegExp( "\\$\\{?SCHEDULER_PARAM_" + schedulerParamNames[i] + "\\}?", "ig" ); paramValue paramValueh1.= paramValue.replace( pattern, schedulerParamValue ); spooler_log.info( "new value of " + paramName + "=" + paramValue ); \} spooler_task.params().value( paramName ) = paramValue; \} \} } |
Substitution of global variables in an order can be carried out in a similar manner.
See also
- How to create global variables
- How to merge global variables into job and order parameters
- Variable_set - (JobScheduler API Reference Handbook)