Skip a step in DTS

  • Hi all,

    This is my first post here so here it goes...

    I'm building a DTS package and I got 7 different path in it. It starts out with a dynamic property task that reads some values from some ini files, then I got a ActiveX script that puts those values into my text files as file names and the email address i email the results to.

    I am creating 6 reports that will run every day and they are fine. A datatask runs a scrips, makes a cvs file, zip it and email it. No problem. But now i'm trying to put a report that only should run once a month. So i'm testing to see if it is the first of the month and then:

    DTSGlobalVariables("SkipTask").Value = True

    so the SkipTask value is true if it is the first of the month. Now I'm trying to skip the datapump task, the cvs file task and zip file task that belong to that report, but still email the other reports. Is this possible?

    I'm been able to skip the tasks using the script from here but the email task does not run so it looks like it thinks my last report didn't succeed.

    Any way I can do this? I really needs some help with this thing

  • Without seeing how your package is setup, I'd say the most likely problem is to do with workflow. Fiddling with the workflow precedence during package execution can lead to a whole pile of issues. Always bear in mind that multiple workflow constraints work as an AND not an OR.

    As you've already been able to implement the task skipping, what you might need to do is break your one large package into several smaller ones. Maybe one for daily reports and another for monthly reports.

     

    --------------------
    Colt 45 - the original point and click interface

  • Thanks for that phill. Creating several small dts packages have crossed my mind, but i do want to do this in one

    I managed to get this working for one, but i just can't get it working for more than that...

    Here is the code i put in for the workflow execution for each part I want to skip.

    Function Main()

    Dim oPkg, oStep

    ' Get the FinalTask Step

    Set oPkg = DTSGlobalVariables.Parent

    Set oStep = oPkg.Steps("DTSStep_DTSExecuteSQLTask_1")

    If DTSGlobalVariables("StartMonth").Value Then

    ' Update the following task's precedence constraint

    ' - Execution status of inactive

    oStep.PrecedenceConstraints(1).PrecedenceBasis = _

    DTSStepPrecedenceBasis_ExecStatus

    oStep.PrecedenceConstraints(1).Value = _

    DTSStepExecStat_Inactive

    Main = DTSStepScriptResult_DontExecuteTask

    Else

    ' Update the following task's precedence constraint

    ' - Execution result of success

    oStep.PrecedenceConstraints(1).PrecedenceBasis = _

    DTSStepPrecedenceBasis_ExecResult

    oStep.PrecedenceConstraints(1).Value = _

    DTSStepExecResult_Success

    Main = DTSStepScriptResult_ExecuteTask

    End If

    Set oStep = Nothing

    End Function

    My last task where I do the email task i called: DTSStep_DTSExecuteSQLTask_1

    The variable i use to test if it is the beginning of the month is called StartWeek

    Is there a way to put an activeX code in the last email task to set a previous workflow to success no matter what?

    PS: is there a code function in this forum? :p

  • So for the email task, how many Precedence Constraints do you have?

    For code you can use the "Formatted" style. Then text is displayed like this

    If DTSGlobalVariables("StartMonth").Value Then
     ' Update the following task's precedence constraint
     ' - Execution status of inactive
     oStep.PrecedenceConstraints(1).PrecedenceBasis = _DTSStepPrecedenceBasis_ExecStatus
     oStep.PrecedenceConstraints(1).Value = _DTSStepExecStat_Inactive
     
     Main = DTSStepScriptResult_DontExecuteTask
    Else
     ' Update the following task's precedence constraint
     ' - Execution result of success
     oStep.PrecedenceConstraints(1).PrecedenceBasis = _DTSStepPrecedenceBasis_ExecResult
     oStep.PrecedenceConstraints(1).Value = _DTSStepExecResult_Success
     
     Main = DTSStepScriptResult_ExecuteTask
    End If

    I usually change the color to blue as well to make it stand out a bit more.

     

    --------------------
    Colt 45 - the original point and click interface

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

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