Friday, June 21, 2013

Decision Task


Working with the Decision Task
The Decision task allows us to enter a condition that determines the execution of the workflow, similar to a link condition with the Decision task. The Decision task has a predefined variable called $Decision_task_name.condition that represents the result of the decision condition. The Integration Service evaluates the condition in the Decision task and sets the predefined condition variable to True (1) or False (0).

We can specify one decision condition per Decision task.

Depending on the workflow, we might use link conditions instead of a Decision task.

Using the Decision Task
We can use the Decision task instead of multiple link conditions in a workflow. Instead of specifying multiple link conditions, use the predefined condition variable in a Decision task to simplify link conditions.

Example: 
1. If you want to copy/move the target file to another location.

2. You have 3 sessions in a workflow and you want to run the 3rd session on success of 1st and 2nd session otherwise do not run 3rd session, you can use decision task.

Create a sample Decision task:
Complete the following steps to create a Decision task.

1. In the Workflow Designer (open any workflow if have created any).

2. From Menu bar click Tasks > Create.
3. Select Decision Task for the task type.
 
Enter a name for the Decision task name <Decision_Flow>.

Click Create. Then click Done.
Now, create a link between tasks Start and s_m_emp_file by using link task. (1st click on Start then drag it to Decision_Flow).
 
 
The Workflow Designer creates and adds the Decision task to the workspace.

4. Double-click the Decision task to open it à go to Properties Tab.
 5. Click the Open button in the Value field to open the Expression Editor.
6. In the Expression Editor, enter the condition you want the Integration Service to evaluate.
Validate the expression before you close the Expression Editor.

7. Click OK.
8. Click Apply and then OK.

9. Add a command task to move data from $PMTargetFileDir to another Location.
Now, create a link between tasks Start and s_m_emp_file by using link task. (1st click on Start then drag it to cmd_copy_files).


10.  Select the link between Decision_flow and cmd_copy files to defined condition.
Validate the expression before you close the Expression Editor, Click OK.

11. Click Apply and then OK.
12. From Menu bar workflow à click start workflow (to run the workflow)

5 comments:

  1. Hi,
    May I know how the decision task will react if there are no conditions provided for the same, provided treat all input links as AND.

    ReplyDelete
  2. Is Multiple conditions also can allow ?

    ReplyDelete
  3. It is useful in situations like if we have three parallel sessions and suppose based on the run status of these three sessions success mail should be sent and failure mail should be sent, if we go by traditional way then we have to create links to both success mail and failure mail tasks from those three sessions but with this task we can avoid that.

    ReplyDelete