AX2527

Conditionally processing tasks in a job

You can configure a task so that it is only processed if a particular condition is met. This feature is configured in the task settings, in the Task Control section, under Process task only if the value of this expression is true.

To enable conditional processing, you must specify a logical expression that will resolve to either true or false when the job is executed. If true, then the task is processed as normal. If false, then the task is skipped.

The logical expression is evaluated using an IF function on the Scheduler server as follows:

=IF(Expression, 1, 0)

You can enter any expression that would be valid in an IF function. You can use Excel functions, Axiom functions, and Scheduler job variables in the expression. If you use a job variable, it must be placed in quotation marks unless you expect the variable value to be resolved and evaluated as a number.

If the task is not processed because the condition resolves to false, this is not considered a failed task. If there are other tasks in the job, they will be processed. If you want an entire job to be conditional, you can do either of the following:

  • Repeat the condition in each individual task settings. Keep in mind that the condition will be evaluated for each individual task, which means that if it is possible for the condition to change in between tasks, some tasks might be processed while others aren't.

  • Use the condition on a Raise Event task that then triggers another job for processing. For more information, see Scheduler task: Raise Event.

Examples

The following are some example expressions for conditional processing:

GetData("Process","FG='2012 Budget'","SystemStatus")=1

If this GetData function returns 1, the expression resolves to true and the task is processed. If not, it is false and the task is skipped.

AND("{EventHandler.EventName}"="ProcessPlanFiles",{Dept}=1000)

If this job was triggered for execution by the ProcessPlanFiles event handler, and if the job variable Dept resolves to 1000, then this expression is true and the task is processed. Note that in the first part of the expression, the event handler variable will return a string value so it must be placed in double quotation marks. In the second part of the expression, the department variable will return a number so it is not placed in quotation marks.

AND(Day(Now())<=7,Weekday(Now())=2)

This expression will return true if it is the first Monday of the month, otherwise it will return false.