Using Constraints and Expressions
Published Mar 25 2019 01:53 PM 236 Views
Copper Contributor
First published on MSDN on Oct 30, 2006

Besides the regular Success and Failure constraints, you can create precedence constraints that are linked to an expression.

In this example, I have a Script Task that determines the course for the workflow.

Besides the pass and fail, I also want to handle a third case that will be executed whenever a special condition is met in the Script Task.

To set this up, I create a new Boolean variable ( varSpecialCase ), and set the value in my Script Task. Double clicking the “Handle Special Case” constraint brings up the Precedence Constraint Editor, where I can change the way the constraint is evaluated.

Here I’ve set “Evaluation operation” to “Expression”, and used my variable in the expression text. If varSpecialCase has been set to true by the Script Task, the “Handle Special Case” script task will be executed.

One thing to keep in mind:  =   !=   ==

(The equals sign is not the same as double equals in the constraint expression!)

I had originally set my expression up using a single equal sign.

As this is still a valid expression, it will validate successfully when you click the Test button.

When you run however, it always fails. After spending a while trying to figure out why my task wasn’t being executed, I finally looked it up the operators in the Integration Services Expression Reference . I’ll definitely look there first, next time!

Version history
Last update:
‎Mar 25 2019 01:53 PM
Updated by: