Il try to disable a containter by an expression but it seems not to work (in VS Debug Mode).
I have an variable defined with int value 1
I use the expression !(@.[User::InteresentenAnzahl]>0) to disable the container.
In between i use and select count(*) from table to populate the variable with the record count.
MY problem is - ssis uses always the design time value of the variable and not the runtime value from the variable.
What could be wrong? Is this possible?
I want to disable tasks because my dependency chain require that some later (dependend) tasks need to be executed.
Best Regards
HANNES
Why you want to enable/disable task based on a condition? Perhpars, you need to make a better use of the precedence constraints in the control flow (yes, the green arrows). You can use expression there that would evaluate the value of the variable and decide wheter or not execute task|||i have a chain of lets say three containters - container one queries the records, countainer two has something to do or not dependend on result of container one (variable) - and countainer tree does something special what need to be done after two.
If I use an expression all later containers does not execute - but if i disable container two contaier three does execute - and thats what i need.
Could you tell me how to configure precedence constraints if the prev container does not execute and the following should execute.
(
this explanation is shorted for the forum - in reall it is processing with some more dependent tasks
1) count new records
2) process add if new records and
3) set last prcessing date (for reporting)
- and processing add needs 20 minutes for zero rows - so why should i execute it) - but I need the last potential processed date to show up how actual data is - this needs to run after a sucessfull process oder if the package runs and no process occured
)
Best regards
hannes
|||
hmayer wrote:
i have a chain of lets say three containters - container one queries the records, countainer two has something to do or not dependend on result of container one (variable) - and countainer tree does something special what need to be done after two.
If I use an expression all later containers does not execute - but if i disable container two contaier three does execute - and thats what i need.
Could you tell me how to configure precedence constraints if the prev container does not execute and the following should execute.
Take a look at this blog post: http://bi-polar23.blogspot.com/2007/05/conditional-task-execution.html
It's not 100% what you're trying to accomplish, but I believe the same technique that worked for me should work for you in this scenario as well.
Basically what you need is an extra container around that thing (be it a task or a container) that you want to disable. Then in the precedence constraint from that new outer container, have the constraint based on an expression. The outer container will execute regardless of whether the inner one does, so the precidence constraints that flow from it will be valid.
And if you need a way to tie a task's execution to an expression but do not know if the task above it will execute, you can add a placeholder Script task above it.
Both of these techniques are demonstrated in this blog post, but please post back here if this doesn't give you all that you need.
|||You should connect the first container to the second and third containers. Also connect the second to the third. Then set the precedence constraints between 1 & 2 with the constraint being between 1 & 3 the converse of 1 & 2.So, for example:
constraint between 1 & 2 : Execute 2 if myVar == 1
constraint between 1 & 3: Execute 3 if myVar != 1|||
Phil Brammer wrote:
constraint between 1 & 2 : Execute 2 if myVar == 1
constraint between 1 & 3: Execute 3 if myVar != 1
I am wrong? but if for container three containter two and container one is required then 3 does not execute if 2 does not execute because 2 &3 does never report completion!
And if I do not have a constraint between 2 & 3 - 3 gets executed if 2 fails!
|||
hmayer wrote:
Phil Brammer wrote:
constraint between 1 & 2 : Execute 2 if myVar == 1
constraint between 1 & 3: Execute 3 if myVar != 1
I am wrong? but if for container three containter two and container one is required then 3 does not execute if 2 does not execute because 2 &3 does never report completion!
And if I do not have a constraint between 2 & 3 - 3 gets executed if 2 fails!
I do not believe that you are wrong - this is the reason I use "empty" Script tasks as placeholders in this sort of scenario so that there is some task from which a precedence constraint can be originated without adding any "real" functionality to the package.
|||
hmayer wrote:
I am wrong? but if for container three containter two and container one is required then 3 does not execute if 2 does not execute because 2 &3 does never report completion!
And if I do not have a constraint between 2 & 3 - 3 gets executed if 2 fails!
First, you set up an OR condition, not an AND condition on the precedence constraints on #3. Also, you do have a precedence constraint between 2 and 3. There just isn't an expression there. (You can put one there if needed.)
#1 -- myVar==1 --> #2 -> #3
| myVar!=1 --> #3|||
Im sorry, but I did not get it.
IF I Setup OR then
- #3 maybe executed befor two
- and whats more dramatic #3 maybe executed if #2 fails - and thats not allowed
|||Phil,
I think that approach does not cover the fact 3 should not be executed if 2 fails.
A while ago, In this post I used a similar approach to what Matt describes; in my case I use an empty dataflow as a place holder, so Script task is not the only one you can use.
http://rafael-salas.blogspot.com/2007/02/ssis-loop-through-files-in-date-range.html
|||
hmayer wrote:
Im sorry, but I did not get it.
IF I Setup OR then
- #3 maybe executed befor two
- and whats more dramatic #3 maybe executed if #2 fails - and thats not allowed
No. Not true.
SC1 will flow to either SC2 or SC3 depending on the expression and how its evaluated. If the flow goes down the SC2 path, then it will execute SC3 only if SC2 was successful. In this case, the execution of SC1 is irrelevant because of the OR'd precedence constraint. (The expression between SC1 and SC2 would be false in this case).
If the flow goes down the SC3 path because @.myVar != 1, then SC2 will never get executed.
Does this make sense?|||
Hi Refael - thats why i ask.
In addition - why does my original aproach - disable - not work, this sould be fine for all my requirements.
(is it a bug - then i will report it - if it works as design I cannot understand)
Best Regards
HANNES
|||
hmayer wrote:
In addition - why does my original aproach - disable - not work, this sould be fine for all my requirements.
(is it a bug - then i will report it - if it works as design I cannot understand)
I don't know if this is a bug or an underdocumented feature, but it appears that you are not the only one with this issue:
http://www.developerdotstar.com/community/node/345
I've always thought of the Disable property as a design-time tool, not a run-time tool, although I've never seen it officially documented as such.
|||
Rafael Salas wrote:
Phil,
I think that approach does not cover the fact 3 should not be executed if 2 fails.
Are you sure?|||
Phil Brammer wrote:
Rafael Salas wrote:
Phil,
I think that approach does not cover the fact 3 should not be executed if 2 fails.
Are you sure?
Pretty sure...
In this control flow, it looks to me like if Sequence Container 1 succeeds and Sequence Container 2 fails, Sequence Container 3 will still execute. I may be missing something, but I remember fighting with similar approaches when coming up with my "Script task as placeholder) technique.
Can you (you, who have the sample package from which the image was taken ) test it quickly?
没有评论:
发表评论