Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically change the work flow between SSIS control flow tasks?

I have an SSIS package, which depending on a boolean variable, should either go to a Script Task or an Email task.(Note: the paths are coming from a Script Task)

I recall in the old dts designer there was a way to do this via code. What is the proper way to accomplish this in SSIS?

like image 204
D.S. Avatar asked Dec 06 '25 04:12

D.S.


2 Answers

Isn't a Conditional Split a data flow task, which takes a row of data and pushes it in one of two directions according to some property of the data???

Oops, that is correct. I found this blog entry which explains how to do proper control flow conditional branching based on boolean values.

like image 164
Harper Shelby Avatar answered Dec 11 '25 05:12

Harper Shelby


In control flow, drag the green arrow to the email task, then right-click on it and you will see you can set it from 'Completed' to 'Conditional', then you can set an expression on the condition. The arrow will then turn blue. You should then be able to drag another arrow to the other script, and set that to conditional.

I have this set-up often, many times you want to email if a certain condition applies. The standard syntax for the conditional constraints is something like:

@[User::SendEmail] == True

Assuming your SendEmail variable is a boolean. If you use anything else, just construct an expression that evaluates to either true or false.

Remember to set the conditionals to OR instead of AND, otherwise it won't complete unless it can take both routes!

like image 38
Meff Avatar answered Dec 11 '25 06:12

Meff