You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

If you want to use date values in order paramters you can add an init job at the begin of your job chain. This job calculates some date variables like hour, month or year and sets the order parameters to provide them.

The init job could be something like this.

 <job  order="yes" stop_on_error="no" name="init">
     <script  language="javax.script:rhino">
         <![CDATA[
 function spooler_process()\{
    var today = new Date ();
 
    var month = today.getMonth()+1; 
    var fullYear = today.getFullYear(); 
    var day = today.getDate();
    var dayOfWeek = today.getDay();   
    var hour = today.getHours();
    var minutes = today.getMinutes();
    var seconds = today.getSeconds();
 
    var lastMonthDate = new Date();
    lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
    var lastMonth = lastMonthDate.getMonth()+1; 
    var lastFullYear = lastMonthDate.getFullYear(); 
    var lastDay = lastMonthDate.getDate();
    var lastDayOfWeek = lastMonthDate.getDay();   
 
    var order = spooler_task.order();
 
    order.params().set_var("month",month);
    order.params().set_var("fullYear",fullYear);
    order.params().set_var("day",day);
    order.params().set_var("dayOfWeek",dayOfWeek);
    order.params().set_var("hour",hour);
    order.params().set_var("minutes",minutes);
    order.params().set_var("seconds",seconds);
 
    order.params().set_var("lastMonth",lastMonth);
    order.params().set_var("lastFullYear",lastFullYear);
    order.params().set_var("day",day);
    order.params().set_var("dayOfWeek",dayOfWeek);
    order.params().set_var("lastDay",lastDay);
    order.params().set_var("lastDayOfWeek",lastDayOfWeek);
  
 	return true;
 \}
         ]]>
     </script>

     <run_time />
 </job>


related downloads:

  • No labels