April 28, 2005 at 9:39 pm
I have a DTS package containing several tasks as usual. I am writing an ActiveX script in the Workflow properties of one of the tasks. (i.e. I need to execute the script just before executing). My question is how do you get an exact reference to my current task, or for that matter any task. I don't want to use a general Task object, because I need to use specialized task methods and properties.
Any suggestions? Please help...
April 28, 2005 at 10:24 pm
Been there tried that, got the t-shirt, etc...
You can't.
Best I could put together is to have a variable that you manually set to the name. Not optimal I know, but it works.
eg: this script alters the precedence constraints based on a global variable.
Option ExplicitConst STEP_NAME = "DTSStep_DTSExecuteSQLTask_1"Function Main()Dim oPkg Dim oStep' Get the FinalTask Step Set oPkg = DTSGlobalVariables.Parent Set oStep = oPkg.Steps(STEP_NAME) If CBool(DTSGlobalVariables("CON_ProcessUBS").Value) = True Then ' Update the following task's precedence constraint to Execution result of success oStep.PrecedenceConstraints(1).PrecedenceBasis = DTSStepPrecedenceBasis_ExecResult oStep.PrecedenceConstraints(1).Value = DTSStepExecResult_SuccessMain = DTSStepScriptResult_ExecuteTask Else ' Update the following task's precedence constraint to Execution status of inactive oStep.PrecedenceConstraints(1).PrecedenceBasis = DTSStepPrecedenceBasis_ExecStatus oStep.PrecedenceConstraints(1).Value = DTSStepExecStat_InactiveMain = DTSStepScriptResult_DontExecuteTask End If Set oStep = Nothing Set oPkg = NothingEnd Function
--------------------
Colt 45 - the original point and click interface
April 28, 2005 at 10:30 pm
Thanks Phill, I'll try it out in a while...
May 1, 2005 at 11:14 am
Never really had to do this, but was wondering, couldn't you grab the parent package2 object, loop the step collection and determine which step object has a "DTSStepExecStatus" of "DTSStepExecStat_InProgress" (2)?
I understand if your Package has parallel Steps this would not work.
Just a though,
-Mike Gercevich
May 1, 2005 at 4:19 pm
Mike
Yes you could do that, but as you've already pointed out, parallel execution brings it undone
What would have been really nice was a method of referencing the current step in the same way that DTSGlobalVariables.Parent references the current package.
--------------------
Colt 45 - the original point and click interface
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply