Logical OR in Control Flow to Skip Task

by Allan Mitchell 28 Oct 2008 08:52

Here is an example of how to do something that in DTS we would have had to do some coding in Script.  In our packages we often find the need to follow one path or another in the Control flow based on some condition that exists at runtime.  In the example below we use a variable value to decide what path to take.

 

Here is the control flow along with the variables pane.

The icons on the workflow indicate we have expressions thereon. The expression on the workflow constraint between tasks 1 and 2 is shown here. As you can see we want the workflow to be followed if our variable has a value of 0 and no errors occurred on task 1.

Between task 1 and task 3 we also have an expression on the workflow and it looks like this

So the opposite in terms of the expression to the previous requirements. This time this route will only be followed if task 1 succeeds and the variable value is NOT = 0. Between tasks 2 and 4 and 3 and 4 you can see a spotted line for the precedence constraint. This indicates a Logical OR (Either of the tasks (2 or 3) can trigger task 4).

So let's test the flow then. Note the changes in variable value

 

Variable value = 0

 

Variable value not = 0

 

 

Quite easy and intuitive I think.

Comments (1) -

10/28/2008 8:25:05 PM #

abd

good for a starter

abd United States

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

RecentComments

Comment RSS