Hello all,
I have a question concerning properties, variables, expressions, and their interactions within a for each loop. I'm still hammering out some details with the SSIS package I have been posting about recently, and I came across this bit of what may or may not be odd behavior (and it may only be odd because it's not doing what I expect).
I have a number of execute sql and script tasks inside a for each container. I am using one of the script tasks to flip a couple of variables on and off that I thought I could use to disable or enable later tasks during run time. What seems to be happening is that when I set disable on those tasks to true, I can no longer run them again in later iterations of the loop.
In other words: I can loop through it three times, with disable set to false via an expression - then the fourth iteration evaluates to true and disables the appropriate tasks, and then any later iterations no longer run any of the disabled tasks whether the expression evaluates true or false. Once disabled, they stay disabled, regardless of expression.
Is this a bug, or is there a "proper" way to do this? Am I foolish to assume that a "dynamic" run-time property is actually changeable with each iteration of a loop?
Have you tried expression based precedence constraints? I'm not sure if those will work either, haven't tested them in a For Each.|||Excellent! Using the workflow arrow with just an expression for precendence gives me the behavior I was expecting, and I don't have to dynamically mess with properties. Thank you for the suggestion!
But I am totally calling shenanigans on the behavior of expressions at the task/property level. That's a bug, IMO, it should have worked both ways.
|||If the tasks are disabled, how can SSIS interrogate them to see if they should be enabled or not?Disabling a task is a runtime check.|||
That's about as profound as "what is the sound of one hand clapping?"
Seriously though, it wasn't clear to me that I wouldn't be able to re-enable once I disabled. There should be a warning or something for newbies that indicates that "disabling" really means "turning off and not enabling again". The proper way was in fact to use the expression in the workflow, and it works well.
No comments:
Post a Comment