Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example showing the substitution of global variables:

No Formatcode
 function spooler_task_before() \{
    var paramNames paramNamesh1.= 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 schedulerParamNamesh1.schedulerParamNames = 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");
            paramValueh1.paramValue = paramValue.replace(pattern,schedulerParamValue);
            spooler_log.info( "new value of " +paramName+"="+paramValue);
        \}
        spooler_task.params.value(paramName) = paramValue;
    \}
 \}