Disable Package Expression

  • Hi SSC,

    I've got 2 Project Variables which I use to control wether a package should run or not through the Disable Package Expression

     

    so I've got myself some neat and tidy Project variables let's call them

    [$Project::DISABLE_TILDE_RELOAD] and [$Project::DISABLE_ARCHIVE_RELOAD]

    If I have only one of them, for example [$Project::DISABLE_TILDE_RELOAD] , the expression @[$Project::DISABLE_TILDE_RELOAD] == True gives me the desired result of the package being disabled.

    I would expect the expression @[$Project::DISABLE_TILDE_RELOAD] == True || [$Project::DISABLE_ARCHIVE_RELOAD] == True to work when I set either of those Project Variables to true (thus disabling the package).

    I could think of something along the lines of:

    [$Project::DISABLE_ARCHIVE_RELOAD] == True ? @[$Project::DISABLE_TILDE_RELOAD] == True ? True : False

    to work but in that case I'm still wondering if the above really would be evaluating both conditions individually to decide wether the outcome is true or false or would DISABLE_ARCHIVE_RELOAD == True be a pre-condition to evaluating DISABLE_TILDE_LOAD?

    As I understand the above would have the DISABLE_ARCHIVE_LOAD Variable as pre-condition for evaluating DISABLE_TILDE_LOAD. Can I evaluate 2 Project Variables independently for one Expression asides from a Script Task?

  • Unless I misunderstand the question, you should be able to enclose your conditions in parens, e.g.:

    I tested the expression below, using two booleans Var1 and Var2.  It returns true if either is variable is true, only returns false if both are false.

    (@[User::Var1] || @[User::Var2]) ? "True" : "False"

     

     

  • If you just use the following it should be doing what you want. If either is true it will be disabled.

    @[$Project::DISABLE_TILDE_RELOAD] || @[$Project::DISABLE_ARCHIVE_RELOAD]

    If this is not doing what you want the issue is most likely somewhere else.

    I guess this would also work, ugly tho.

    @[$Project::DISABLE_ARCHIVE_RELOAD] == False ? @[$Project::DISABLE_TILDE_RELOAD] == False ? False : True : True

     

  • I've got 2 Project Variables which I use to control wether a package should run or not through the Disable Package Expression

    I don't have SSIS in front of me right now, but as far as I remember, there is no such thing as a 'Project Variable'. The $Project items you refer to are 'project parameters' and their values, unlike variables, cannot be modified at runtime.

    If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
    See https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help/ for details of how to post T-SQL code-related questions.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply