Friday, November 30, 2012

SSIS Control flow with Precedence constraints need to come together

Problem:
  • When developing in an SSIS For each loop, e.g. process a set of files in a directory.
  • Where different actions need to be undertaken depending on the file type
  • And Precedence constraints are used to accomplish those different actions in separate dataflow tasks.
  • After the separate dataflow tasks, link those to one more tasks common to all constraints.
  • Then: the result will be that the common tasks are never executed.
Example:
  • In the example The Move the File task will not be executed.
Cause:
  • Constraint expressions not only work at the exit of a task. The are also active at the entry of a task.
  • In the example: the 2 green arrows pointing to the common task 'Move the file' need to be valid simultaneously, before the common task gets executed. But it is either File type A or file type B that gets processed in one iteration of the Foreach file loop.
Solution:
  • Double click the green arrow going from 'process type A' to 'Move the file'.
  • Change the Multiple constraints property from logical AND to logical OR.
  • The green line will change to a dotted green line, for both tasks A and B.
Example:


No comments: