...
where the global variable $ODAT
represents a date and has been set as described in the the How to set job and order parameters by substituting 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.
...
Code Block |
---|
function substituteParams( paramName ) {
var paramValue = spooler_task.params().value( paramName );
if(paramValue.search(/\$/) > -1) {
var schedulerParamNames = spooler.variables().names().split( ";" );
for( var i in schedulerParamNames ) {
if(paramValue.search(/\$/) == -1) {
break;
}
var schedulerParamValue = spooler.variables().value( schedulerParamNames[i] );
spooler_log.info( "Substitute: " + paramName + "=" + paramValue + " with " + schedulerParamNames[i] + "=" + schedulerParamValue );
var pattern = new RegExp( "\\$\\{?SCHEDULER_PARAM_" + schedulerParamNames[i] + "\\}?", "ig" );
paramValue = paramValue.replace( pattern, schedulerParamValue );
spooler_log.info( "new value of " + paramName + "=" + paramValue );
}
spooler_task.params().value( paramName ) = paramValue;
}
}
|
...