Using ActiveX in DTS package

  • Any help would be appreciated.

    I am creating a DTS package with several steps. My problem involves two steps, an ActiveX and an SQL task.

    I have a statement within the ActiveX task:

    If oFile.Size > 14 Then

       Main = DTSTaskExecResult_Success

      Else

      Main = DTSTaskExecResult_Failure

    End If

    I thought this would set the workflow to either success or failure, it always succeeds. I want different two different SQL task to perform depending on the results.

    OR

    I can change my two SQL task to one. If, by populating a global vairable within my ActiveX script. But, I have trouble referencing a global variable within the SQL task. Does anyone have an example of how to use a global variable in a SQL task?

  • I create a variable called PilotRun in the DTS package properties and set it via command line run (we use a host scheduler and have to use DTSRun).  Here is one of our ActiveX scripts for one of our packages

     

    Function Main()

    IF UCase(DTSGlobalVariables("PilotRun").value) = "YES" THEN

        DTSGlobalVariables("gsAppendPPRwadjScript").value = LEFT(DTSGlobalVariables("gsAppendPPRwadjScript").value, _

           LEN(DTSGlobalVariables("gsAppendPPRwadjScript").value) - 4) & "_pilot.kix"

        DTSGlobalVariables("gsRemovePPRwadjScript").value = LEFT(DTSGlobalVariables("gsRemovePPRwadjScript").value, _

           LEN(DTSGlobalVariables("gsRemovePPRwadjScript").value) - 4) & "_pilot.kix"

        DTSGlobalVariables("gsPPRetailAdjFile").value = LEFT(DTSGlobalVariables("gsPPRetailAdjFile").value, _

           LEN(DTSGlobalVariables("gsPPRetailAdjFile").value) - 12) & "\Pilot\" & _

           "wklyadj.txt"

    END IF

    DTSGlobalVariables("gsAppendPPRwadjCommand").value = DTSGlobalVariables("gsKixMgnrExe").value & " " & _

           DTSGlobalVariables("gsKixExe").value & " " &_

           DTSGlobalVariables("gsAppendPPRwadjScript").value

     

    DTSGlobalVariables("gsRemovePPRwadjCommand").value = DTSGlobalVariables("gsKixMgnrExe").value & " " & _

           DTSGlobalVariables("gsKixExe").value & " " &_

           DTSGlobalVariables("gsRemovePPRwadjScript").value

     Main = DTSTaskExecResult_Success

    End Function



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

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

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