One common usage for the expression task in SSIS is to implement conditional flow of the constraints. In the below screenshot you can see that we implement an expression tasks which follows an error checking activity and evaluates if there were any errors , if yes the execution move to the right else to the left.
In order to do this I need to evaluate a variable for error count and then assign true or false to the output of the expression task. Unlike SSRS where we are provided with functions for conditional logic in SSIS we need to write the below formula within the Expression task.
@[User::AllsWell])=@[User::ErrorCount])==0 ? “False” : “True”
In this case I am assigning the output of the calculation done in the RED text to the Variable “AllsWell”
Once done I assign the values to the Precedence constrain ( Green Arrow) to tell it how to behave when there are no errors
(DT_WSTR, 10) @[User:: AllsWell]==”True”
And when there are errors
(DT_WSTR, 10) @[User:: AllsWell]==”False”
Please Consider Subscribing