AX1554
Using iterative task processing
You can configure a Scheduler task to use iterative processing, so that the task is repeated multiple times using a designated list of values. Each iteration of the task uses a different item in the list, until all items have been processed.
When you enable iterative processing for a task, you define the list of values by specifying a table column and an optional filter. The task will then be processed for each unique item in the table column. You can reference the column values within the task properties by using a built-in Scheduler job variable. As each iteration of the task is processed, the variable is replaced with the column value for the current iteration. Using this approach, the task can dynamically change for each iteration.
For example, you may have an import that you want to perform for four different entities in your organization. The import configuration is exactly the same except that the source file or query is different for each entity. If the import uses entity as a variable, then you can set up a single import task and configure it to iterate over the list of entities. Each iteration uses a different entity name or code, which you can pass into the import variables so that the import uses the correct source file or query for the current entity.
Enabling iterative processing
Iterative processing is enabled in the Task Control properties of the task. Select the task within the Scheduler job, then click Task Control to expand that section. Any task can use iterative processing, though it is more useful for certain task types such as Import ETL Package.
Complete the following properties in the Iteration section of the Task Control properties.
(missing or bad snippet)When iterative processing is enabled for a task, the iterations are always processed within a subordinate job. Therefore, enabling the Task Control option of Create a Subordinate Job for this Task is unnecessary.
If your job has multiple tasks, and you want the tasks after the iterative task to wait for all iterations to complete before executing, then you must enable the following Task Control option for the iterative task: Wait for all Subordinate Jobs to complete before proceeding to the next Task.
Configuring the task to change for each iteration
In order for the Scheduler task to apply the current iteration value to each iteration, you must use the built-in iteration variables within the task. These variables are job variables, and can be used like any other job variable. The following variables are available:
Variable | Description |
---|---|
{Task.CurrentIterationValue} | Returns the current value from the iteration list. |
{Task.IterationNumber} | Returns the number of the current iteration. |
To continue the previous example, imagine that you are setting up an import for iterative processing by entity. To define the list of entities, you set up the Iteration settings in the Task Control section like the following:
This example will iterate over the list of entities in the Entities column, limited to only those entities where the Costing column is set to True. If this resolves to 4 entities, then the task will be processed 4 times, once for each entity.
The import is configured with a variable {Entity}
, which it uses to process the correct entity source file. In order to pass the current task iteration value to the import variable, you can use the job variable {Task.CurrentIterationValue}
in the import task settings. For example:
When the first iteration is performed, the {Task.CurrentIterationValue}
will be resolved as Entity_1, so the import will be processed using Entity_1 as the value for the {Entity}
import variable. For the second iteration, the value Entity_2 will be used, and so on. Using this approach, the import will be processed for all entities in the iteration column.