Creating a Decision step which is used to control the task process flow

The ‘Decision’ step is a General tool used to control the flow of a task process based on a result of one or more expressions.

The decision works by testing a sequence of true or false conditions. From the Decision step, branches are created to direct how a task result is produced. If for example a ‘true’ condition is returned then that particular branch of the process is followed.

Important: A decision is only made once in a task run. I.e. only one of the branches will be processed. If a task is processing a recordset then all rows in the recordset will be processed through the same branch. If it is required to process a recordset down two branches depending on the content of rows in the recordset then consider creating two tasks and use a data filter to determine which rows are processed in which task.

Example: A task purpose is to respond to an enquirer by email who has requested information about a specific product.

Two branches are configured in the Decision step. If documents are available for the product then the ‘Docs Found’ branch is used to send an email to the enquirer with the attached documents. If no documents are found then the ‘No Docs Found’ branch is used and an appropriate response is given.

This works simply by using an expression which looks at how many rows are being produced by the database query step. If no rows are returned then this indicates that documents are not available.


Using the Decision Tool

The Decision tool is dragged from the task browser under General tools and into the task planner. You must double-click the step to enter the main dialog of the tool.

Here, a name is given to the step and by using the relevant buttons you can Add, Edit and Remove decision branches. A decision branch is the path the task will take.

A field at the bottom labelled Decision (Logical Expression) will display the script in use when a created decision branch is clicked on.


Creating a Decision Branch

  1. Provide an appropriate name for the step and select Add.
  2. The Decision Editor dialog will now be displayed where the branch is labelled and a target step is selected.
    Provide a name and description for the branch and using the To drop down menu, select a step for the branch to connect to.
    The name provided will also display on the task planner on top of the link between the Decision step and the target step.
  3. Select the Script tab. Here you define the criteria and logic that will be used to decide if this branch will be used or not by the task.
    Capture3Expression (logical) – This field is where a VB script expression is created. Text can be manually entered or alternatively columns, step properties, variables, functions and formulas may be dragged and dropped into the expression field from the task browser.

    Else (tick box) – This tick box is used for when conditions of any other decision branches have not been met. The script will simple say ‘Else’. By default it will be greyed out until at least one other decision branch has been created.

  4. Start creating the expression by first defining what value is going to be looked at, either manually enter the script or drag and drop from the task browser.

  5. Next define what the value is going to be compared against.

  6. Once the script has been entered select OK to save and complete. This will close the Branch Editor and display the following:

  7. A second branch will now need to be created to provide an alternative outcome for the step. Repeat the procedure again to create another decision branch. Remember that if the expression only needs to be where the condition has not been met by another branch, use the Else tick box of the Script tab.
    Capture6A second branch will appear in the table.
  8. Select OK to save and close the Decision tool and return to the task planner. The created decision branches should have connected themselves to their specified target step. The task has now been setup to produce two alternative outcomes based on certain conditions.

To read about tasks which make use of this tool see:

Learn about: Building a task which uses a decision step to control the task process flow