Disabling tasks through Expressions

by Darren Green 28 Oct 2008 08:43

All Containers include a Disable property. This is what is used for the right-click Disable/Enable functionality you may have used when developing packages in the designer. Expressions are evaluated at run-time and can be used to set properties, so it follows that you could use an expression on the Disable property to control execution of the container.

This will not always work. By design, the Disable property is evaluated quite early on during package execution. This may be before you have set a variable that is subsequently used within your Disable property expression. This may caused unexpected results, and therefore should be avoided. The better way to disable a task is to use an expression within a precedence constraint. The expression will be evaluated when the constraint is tested, immediately before the constrained container is expected to execute, so it will always use the latest value for any variables or functions in the expression. Expressions on Precedence Constraints are easier to use, more visible, and as explained above, the correct way to disable your container.

Comments (2) -

6/17/2009 9:26:45 AM #

John Mitchell

The problem with this is where the task you are seeking to disable runs in parallel with other tasks, all of which have a subsequent precedence constraint to the same task.  This will stop the subsequent task from executing unless all of the parallel tasks have executed.  We can't use an OR to evaluate the precedence constraints, either, because we don't know at design time which of the parallel tasks will be executed.  Hope that makes sense... is there any way round this?

Thanks
John

John Mitchell United Kingdom

6/18/2009 6:49:28 PM #

Allan Mitchell

John

If you disable a task then so long as you do not force a failure execution result then it will return "I did not fail" Look Here www.sqlis.com/.../...cess-Workflow-Constraint.aspx

So 4 Source Tasks going to 1 Follow Task where 2 of the Source Tasks are disabled and the constraints between Source and Follow Tasks are "On Success" and "And" or "Or" will work just fine.

Did I understand your situation?

Allan Mitchell United Kingdom

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading