Sunday, July 21, 2013

Precedence Constraints

In the previous articles while looking into the Control Flow tasks we would have observed pointed arrows that connect these tasks. These arrows are not merely for directing the Workflow of a SSIS package but have much more functionality embedded in them.

To begin with ,in SSIS these pointed arrows that link control flow tasks are called Precedence Constraints.

Precedence constraints(PC’s) link the individual executable(Control Flow Task) together and determine how the workflow moves from one executable to the next (An executable can be a For Loop, Foreach Loop, or Sequence container, a control flow task or an event handler).

The linked executable can be divided as :a) Precedence executable (the task from where the Precedence constraint originates)
b) Constrained executable (the task from where the Precedence constraint terminates/points to)

Work flow is defined in the control flow using Precedence Constraint Editor which provides an option to define the work flow in two ways-

1)       Defining Work Flow by Success or Failure or Completion-  This can be done by setting the Value property in the Precedence Constrain editor which provide three options-
§  Success: The precedence executable must run successfully for the constrained executable to run. PC is set to green when the Success option is selected.
§  Failure: The precedence executable must fail for the constrained executable to run. PC is set to red when the Failure option is selected.
§  Completion: The constrained executable will run after the precedence executable runs, whether the precedence executable runs successfully or whether it fails. PC is set to blue in this case.

                   

2)       Defining Work Flow by Expressions-  This can be done by setting the Evaluation Operation property in the Precedence Constrain editor which provide below options-
§  Constraint: The precedence constraint is evaluated solely on the option selected in the Value property.
§  Expression: The precedence constraint is evaluated based on the expression defined in the expression text box. If the expression evaluates to true, the workflow continues and the constrained executable runs. If the expression evaluates to false, the constrained executable does not run.
§  Expression and Constraint: The precedence constraint is evaluated based on both the Value property and the expression. Both must evaluate to true for the constrained executable to run.
§  Expression or Constraint: The precedence constraint is evaluated based on either the Value property or the expression.

Apart from the above properties we have one more property in the Precedence Constraint Editor Logical AND and Logical OR. This property will come into the picture when constrained task will have multiple constraints.

                                                                                                Logical AND                                                                                         Logical OR
Description: cid:image015.jpg@01CD6F3B.F99BE6F0                              Description: cid:image016.jpg@01CD6F3B.F99BE6F0                                                
                                    (Task ‘C’ will execute when Task A and Task B completes successfully)       (Task ‘C’ will execute when either of Task A or Task B completes successfully)                                               


Please note that, two tasks shall execute in parallel, if they are not connected through precedence constraints.

No comments:

Post a Comment