Task Expression Evalutation Time

I have designed a package whose first step initializes several variables.  Other steps in the package have expressions based on those variables.

Example Expression for MyTask:
   PropertyName = "Disable"
   Expression = "@DoMyTask"

Given this example MyTask will be enabled/disabled solely based on the value of @DoMyTask at the time the package execution begins.  Changing the value of @DoMyTask prior to the normal execution of MyTask has no effect.

My conclusion is that the expression is not being evaluated late enough.  Any help


Answer this question

Task Expression Evalutation Time

  • Knuckles

    Don't use the Disable property to do this, use an expression on a precedence  constraint instead.

  • Fil52724

    I have explored that option, but there are steps that follow the disabled step that need to go off.  A disabled step acts perfectly.  Here is a better description of my package.

    if @DoMyTask1 then
       MyTask1
    if @DoMyTask2 then
       MyTask2
    ...

    If I do MyTask! or if @DoMyTask1 is false then I want to proceed to MyTask2, but if MyTask1 fails I do not want to proceed to MyTask2.  As I understand Precedence Constraints your suggestion will not work.

  • Paulus55

    Jamie or Allan,
    Is there a way to set up this type of flow using Precedence Constraints   If not wouldn't a disable expression be a very nice solution except for the evaluation time issue

    If I am still not explaining my issue clearly should I submit a small dtsx example   If so how should I do that   In text

  • Yarik

    Doesn't Jamie's blog post cover your scenario I think the use of constraints and sequence containers works rather well, but do you require more

    If you want to upload a simple package that demonstrates the issue, us wiki.sqlis.com, it has an upload feature that accepts packages. We are still testing it, but mail me darren at sqldts if you have any problems.

  • 0x00

    Jamie,
    Thanks for looking at this with me.  I can write the precedence constraint between Task1 and Task2 so that it reads something like "Task1.Success and @DoTask2".  That works fine, but what about @DoTask1 and Task3.  I have no precedence constraint to check @DoTask1.  Also if @DoTask2 is false I want to consider Task2 successful and move on toward Task3.  Does that make since

    Sorry I missed your first post between mine.

  • Floax

    Disabling a task should not be done outside of dev. Expressions on workflow should be the way forward for you. Did the example link help any As Darren has said, if you want to post the package up or graphics then use wiki.sqlis.com and write a narrative. This way everyone can see your package setup and it would help us to visualise any issues. Allan "Grant Perry@discussions.microsoft.com" wrote in message news:f1787785-5707-474e-a6e1-581db7c855e1@discussions.microsoft.com: > Jamie or Allan, > Is there a way to set up this type of flow using Precedence Constraints > If not wouldn't a disable expression be a very nice solution except for > the evaluation time issue > > If I am still not explaining my issue clearly should I submit a small > dtsx example If so how should I do that In text
  • Lynda Webeler

    I have worked around this problem by using For Loop items that only execute at most once, but obviously this is a less than ideal solution.

    I would love to hear about anything that others have used for this situation.

  • Stig Nielsson

     Grant Perry wrote:
    Jamie,
    Thanks for looking at this with me.  I can write the precedence constraint between Task1 and Task2 so that it reads something like "Task1.Success and @DoTask2".  That works fine, but what about @DoTask1 and Task3.  I have no precedence constraint to check @DoTask1.  Also if @DoTask2 is false I want to consider Task2 successful and move on toward Task3.  Does that make since

    Sorry I missed your first post between mine.


    I'm still finding it really hard to understand your situation, sorry.

    I've found in the past that complicated workflow that cannot be achieved using precedence constraints betwen your tasks can someties be achieved instead by employing sequence containers to affect workflow. Like so: http://blogs.conchango.com/jamiethomson/archive/2005/07/27/1889.aspx

    I have no idea whether that will help you or not!

    -Jamie


  • pooja.t.jain

    Jamie,
    Sorry for not being more clear.  I should have really posted screen shots or something, but your link is actually describing my very situation, except on a smaller scale.  The work around I mentioned and am currently using is essentially what your link describes, except I am using "For Loop Containers" instead of "Sequence Containers". Here are exemplary values for one of my for loops...

    InitExpression = "@LoopHack = 1"
    EvalExpression = "@LoopHack != 0 && @DoTask1"
    AssignExpression = "@LoopHack = 0"

    I would have preferred, if not for the errors...

    InitExpression = "@LoopHack = true"
    EvalExpression = "@LoopHack && @DoTask1"
    AssignExpression = "@LoopHack = false"

    But this to me really is a work around.  What I would really like to see is the Disable Expression be evaluated each time the Disable property is read, i.e. immediately before potentially executing the step.  So your example would turn into...

    A --> B(disabled by expression) --> C


  • InKi Park

    Why do you think precedence constraints won't work They seem perfectly suitable to this scenario - although perhaps I'm misunderstanding.

    You are aware that precedence constraints do alot more than ExecuteOnSuccess, ExecuteOnFailure, ExecuteOnCompletion (which is what DTS did) aren't you

    Are you able to post a screenshot anywhere Its hard to visualise it.

    -Jamie


  • Daniel Petrik

    The more research and discussion I do the more convinced I am that Precedence Constraints do not meet the need I am trying to describe, but I could be wrong.  Is there a way to create the type of execution flow Jamie describes in his link by using Precedence Constraints
  • Roda Chan

     Grant Perry wrote:
    I have worked around this problem by using For Loop items that only execute at most once, but obviously this is a less than ideal solution.

    I would love to hear about anything that others have used for this situation.


    Why don't precedence constraints work

    -Jamie


  • DamienAtCox

    You also now have a logical OR available to you as well as expressions on precedence constraints. Reading your explanation it sounds as though this will do what you want. So an example may be Task 1 fires and sets a variable Based on the variable task 2 fires or task 3 Task 4 should fire whether or not it was invoked by 2 or 3. Probably best in pictures http://wiki.sqlis.com/default.aspx/SQLISWiki/LogicalOrExample.html If this is not your situation then please shout. Allan "Grant Perry@discussions.microsoft.com" wrote in message news:993af043-bec0-4373-ad80-c36f4a3bc768@discussions.microsoft.com: > I have explored that option, but there are steps that follow the > disabled step that need to go off. A disabled step acts perfectly. > Here is a better description of my package. > > if @DoMyTask1 then > MyTask1 > if @DoMyTask2 then > MyTask2 > ... > > If I do MyTask! or if @DoMyTask1 is false then I want to proceed to > MyTask2, but if MyTask1 fails I do not want to proceed to MyTask2. As I > understand Precedence Constraints your suggestion will not work.
  • MKMahesh

     DarrenSQLIS wrote:
    Doesn't Jamie's blog post cover your scenario I think the use of constraints and sequence containers works rather well, but do you require more


    Jamie's post does cover my scenario, and my use of the "For Loop Container" is an equally good solution.  But both solutions are vastly inferior to a simple conditional execution expression.  Do you not agree   The "For Loop Container" provides this concept, but it is a loop.  Shouldn't all "Control Flow" items have conditional execution   It seems like you are so close to providing it.  I don't understand the hesitation.

  • Task Expression Evalutation Time