SSIS – Working with 3 Constraints Where 2 Should Be OR and One Should Be AND

ssis-2016

So I have an SSIS flow in which I am working with three constraint within a task, but 2 of them must be an OR and one must be an AND. In pseudo-code would be something like:

if ( (constraint-a OR constraint-b) AND constraint-c)

Problem is, we can only set OR/AND to all precedents:

Precedence Constraint Editor: Multiple constraints

Are there any solutions in which we could group some of these constraints?

Best Answer

Here is my original solution for this problem, which apparently is not as bad as I thought. The only problem with it is that the designer canvas can get quite crowded.

I managed to achieve the desired solution with a little kludge, which gives me exactly what I want. However I can't help but feel a little dirty doing it, so I wonder if there is a better way. Here is a diagram of what I have done:

Diagram of flow

NOTE: It is important to emphasise that I need Main Script B to start as soon as Main Script A completes.

Script Task B1 is the one requiring the complex constraint. As you can see in the centre of the diagram, I grouped failure of Main Script A and completion of Script Task A2 in an empty container.

This allows for script tasks A1 and A2 to be bypassed if Main Script A fails, and Script Task B1 to be executed after previous script tasks have been completed. But Script Task B1 must wait for Main Script B to finish as well.

Here are the results using this cheap kludge:

When Main Script A succeeds: Main Script A Success

When Main Script A fails: Main Script A Failure

I wonder if there are alternatives to this solution, though.