September 22, 2004 at 6:41 pm
I've got a workflow script that enables subsequent steps depending on the value of a global variable.
Option Explicit
Const A_STEP = "DTSStep_DTSActiveScriptTask_3"
Const B_STEP = "DTSStep_DTSActiveScriptTask_2"
Function Main()
Dim oStp
Dim sStepName
If DTSGlobalVariables("bDecide").Value Then
sStepName = A_STEP
Else
sStepName = B_STEP
End If
'Set oStp = DTSGlobalVariables.Parent.Steps(sStepName)
Set oStp = DTSGlobalVariables.Parent.Steps(A_STEP)
oStp.DisableStep = False
Set oStp = Nothing
Main = DTSStepScriptResult_ExecuteTask
End FunctionIf I use the line that is commented out I get a Type Mismatch error. However, the line that references the constant directly functions correctly.
Any ideas?
--------------------
Colt 45 - the original point and click interface ![]()
September 23, 2004 at 7:02 am
I'm not sure, but I think that you need to declare sStepName as a global variable in the package.
I hade trouble before when using dim to declare a variable and set it to a value. It did not always work. The global variable always does.
September 24, 2004 at 4:17 am
I don't that's problem. I'm thinking it's something to do with the the fact that it's a workflow script, not just a regular ActiveScript task.
I changed it to this and it works fine.
Option Explicit
Const A_STEP = "DTSStep_DTSActiveScriptTask_3"
Const B_STEP = "DTSStep_DTSActiveScriptTask_2"
Function Main()
If DTSGlobalVariables("bDecide").Value Then
DTSGlobalVariables.Parent.Steps(A_STEP).DisableStep = False
Else
DTSGlobalVariables.Parent.Steps(B_STEP).DisableStep = False
End If
Main = DTSStepScriptResult_ExecuteTask
End Function--------------------
Colt 45 - the original point and click interface ![]()
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply