Precedence Constraints and Config Files

  • Here's a question kind of out of left field. I would appreciate any suggestions if you have any.

    I have a precedence constraint between two tasks on the Control Flow. The constraint has a Success & Expression condition on it with the Expression checking for the value of a variable called @DayNum. The variable is set in the first task and only if it equals a certain number does it proceed with the second task. The thing is, I need to be able to change this check without having to change the package.

    I'd like to put this into an XML config file with all my other values to do so, but can't figure out what item to choose on the Objects list (when editing a config file) to do so. I don't want the variable itself because that will cause the condition to always equal either true or false (forcing the value of the variable over the task that checks the day number of the week). I want to put the actual expression in the constraint (@DayNum == 2) in the config file.

    Any thoughts on this one?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • When you say you want to change the check, what do you mean exactly? Will the value of the @DayNum need to be a different value to evaluate to TRUE, or do you mean that the value of @DayNum can be ignored, and simply if the previous task is successful then the precedent constraint is met?

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Brandie

    Why not create a new variable called @DayNumTarget, set the value of that in your config file, and change the constraint to (@DayNum == DayNumTarget)?

    John

  • Brandie Tarvin - Thursday, August 10, 2017 4:07 AM

    Here's a question kind of out of left field. I would appreciate any suggestions if you have any.

    I have a precedence constraint between two tasks on the Control Flow. The constraint has a Success & Expression condition on it with the Expression checking for the value of a variable called @DayNum. The variable is set in the first task and only if it equals a certain number does it proceed with the second task. The thing is, I need to be able to change this check without having to change the package.

    I'd like to put this into an XML config file with all my other values to do so, but can't figure out what item to choose on the Objects list (when editing a config file) to do so. I don't want the variable itself because that will cause the condition to always equal either true or false (forcing the value of the variable over the task that checks the day number of the week). I want to put the actual expression in the constraint (@DayNum == 2) in the config file.

    Any thoughts on this one?

    Do you want complete flexibility over this, so one day your condition is 
    @DayNum == 2
    and the next it is
    @Success == 12 (or whatever)

    Or are you just wanting to be able to control the constant part to the right of == ?


  • Thom A - Thursday, August 10, 2017 4:18 AM

    When you say you want to change the check, what do you mean exactly? Will the value of the @DayNum need to be a different value to evaluate to TRUE, or do you mean that the value of @DayNum can be ignored, and simply if the previous task is successful then the precedent constraint is met?

    The value of @DayNum will change. We get a file on a certain day of the week from another office. The variable kicks off a "no file today" message if the day of the week (say day 2) comes and it doesn't see a file. Unfortunately, the sending office sometimes (once a year, maybe) changes what day of the week we're going to get that file.

    Why not create a new variable called @DayNumTarget, set the value of that in your config file, and change the constraint to (@DayNum == DayNumTarget)?

    John

    Hrmm. Now there's a thought. I wonder if the precedence constraint will evaluate a variable with no arguments...

    Or are you just wanting to be able to control the constant part to the right of == ?

    This part. But the issue is, this variable is set by an Execute SQL Task. So I cannot put the variable itself into the config file or it will override what the Execute SQL Task does. And there's no way in the expression of a precedence constraint to pull in a parameter from another source (at least not one I can see).

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • I assume it's running from some kind of Agent task? Could you set up a parameter instead, say CurrentDayNum. In the job you can set the value of the parameter to 2, and if it changes later it's much easier to edit than the package. Then, like the others have said, use a expression along the lines of: @[$User::DayNum] == @[Package::CurrentDayNum]
    Love that emoticons show up in code markup. >_<

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Brandie Tarvin - Thursday, August 10, 2017 6:58 AM

    Why not create a new variable called @DayNumTarget, set the value of that in your config file, and change the constraint to (@DayNum == DayNumTarget)?

    John

    Hrmm. Now there's a thought. I wonder if the precedence constraint will evaluate a variable with no arguments...

    Nope. Doesn't work. I can't even get past the expression of the second variable with the == and setting it as a quoted string won't work for the precedence constraint.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Thom A - Thursday, August 10, 2017 7:07 AM

    I assume it's running from some kind of Agent task? Could you set up a parameter instead, say CurrentDayNum. In the job you can set the value of the parameter to 2, and if it changes later it's much easier to edit than the package. Then, like the others have said, use a expression along the lines of: @[$User::DayNum] == @[Package::CurrentDayNum]
    Love that emoticons show up in code markup. >_<

    ACK!

    It worked. IT WORKED... Wow. I'd never used "Set Values" before on a job step. I didn't think it would be possible... Thanks, Thom!

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin - Thursday, August 10, 2017 7:56 AM

    Thom A - Thursday, August 10, 2017 7:07 AM

    I assume it's running from some kind of Agent task? Could you set up a parameter instead, say CurrentDayNum. In the job you can set the value of the parameter to 2, and if it changes later it's much easier to edit than the package. Then, like the others have said, use a expression along the lines of: @[$User::DayNum] == @[Package::CurrentDayNum]
    Love that emoticons show up in code markup. >_<

    ACK!

    It worked. IT WORKED... Wow. I'd never used "Set Values" before on a job step. I didn't think it would be possible... Thanks, Thom!

    <headdesk>. Of course I can also put THAT variable in the config file... DUH.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Brandie Tarvin - Thursday, August 10, 2017 8:04 AM

    Brandie Tarvin - Thursday, August 10, 2017 7:56 AM

    Thom A - Thursday, August 10, 2017 7:07 AM

    I assume it's running from some kind of Agent task? Could you set up a parameter instead, say CurrentDayNum. In the job you can set the value of the parameter to 2, and if it changes later it's much easier to edit than the package. Then, like the others have said, use a expression along the lines of: @[$User::DayNum] == @[Package::CurrentDayNum]
    Love that emoticons show up in code markup. >_<

    ACK!

    It worked. IT WORKED... Wow. I'd never used "Set Values" before on a job step. I didn't think it would be possible... Thanks, Thom!

    <headdesk>. Of course I can also put THAT variable in the config file... DUH.

    Glad you got there! Sometimes the simple things are the easiest to miss. 😉

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

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

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