dbTalk Databases Forums  

how to skip a task in DTS - depending on criteria

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss how to skip a task in DTS - depending on criteria in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Raj
 
Posts: n/a

Default how to skip a task in DTS - depending on criteria - 12-16-2005 , 09:33 AM






Hi,

Im having trouble de-activating a task (DTSStep_DTSDataPumpTask_1) if a
certain datasource has no data in it.
The error which i am getting is: Invalid Step Result Value.

Could anyway help?
Raj


This is the script i am executing:


Function Main()

Dim oFSO, File, oStep, oPkg, oDataPump

File = DTSGlobalVariables.Parent.Connections("D2RL
Copy").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPkg = DTSGlobalVariables.Parent

Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")

If oFSO.FileExists(File) Then

msgbox "exists"

If oFSO.GetFile(File).Size > 0 Then

Main = DTSStepExecResult_Success
Else
msgbox "file is empty"

' Update the following task's precedence constraint
' - Execution status of inactive
'the precedence for both PBasis and Value is set to 0

msgbox(oStep.PrecedenceConstraints(1).PrecedenceBa sis)
msgbox(oStep.PrecedenceConstraints(1).Value)

oStep.PrecedenceConstraints(1).PrecedenceBasis = _
DTSStepPrecedenceBasis_ExecResult
oStep.PrecedenceConstraints(1).Value = _
DTSStepExecStat_Inactive

End If
Else

Main = DTSStepScriptResult_DontExecuteTask

End If

Set oFSO = Nothing

End Function


Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: how to skip a task in DTS - depending on criteria - 12-20-2005 , 06:15 AM






There are some examples here-

Workflow
(http://www.sqldts.com/?103)


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com

"Raj" <bassi.raj (AT) gmail (DOT) com> wrote

Quote:
Hi,

Im having trouble de-activating a task (DTSStep_DTSDataPumpTask_1) if a
certain datasource has no data in it.
The error which i am getting is: Invalid Step Result Value.

Could anyway help?
Raj


This is the script i am executing:


Function Main()

Dim oFSO, File, oStep, oPkg, oDataPump

File = DTSGlobalVariables.Parent.Connections("D2RL
Copy").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPkg = DTSGlobalVariables.Parent

Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")

If oFSO.FileExists(File) Then

msgbox "exists"

If oFSO.GetFile(File).Size > 0 Then

Main = DTSStepExecResult_Success
Else
msgbox "file is empty"

' Update the following task's precedence constraint
' - Execution status of inactive
'the precedence for both PBasis and Value is set to 0

msgbox(oStep.PrecedenceConstraints(1).PrecedenceBa sis)
msgbox(oStep.PrecedenceConstraints(1).Value)

oStep.PrecedenceConstraints(1).PrecedenceBasis = _
DTSStepPrecedenceBasis_ExecResult
oStep.PrecedenceConstraints(1).Value = _
DTSStepExecStat_Inactive

End If
Else

Main = DTSStepScriptResult_DontExecuteTask

End If

Set oFSO = Nothing

End Function




Reply With Quote
  #3  
Old   
mattb
 
Posts: n/a

Default RE: how to skip a task in DTS - depending on criteria - 01-06-2006 , 03:05 PM





"Raj" wrote:

Quote:
Hi,

Im having trouble de-activating a task (DTSStep_DTSDataPumpTask_1) if a
certain datasource has no data in it.
The error which i am getting is: Invalid Step Result Value.

Could anyway help?
Raj


This is the script i am executing:


Function Main()

Dim oFSO, File, oStep, oPkg, oDataPump

File = DTSGlobalVariables.Parent.Connections("D2RL
Copy").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPkg = DTSGlobalVariables.Parent

Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")

If oFSO.FileExists(File) Then

msgbox "exists"

If oFSO.GetFile(File).Size > 0 Then

Main = DTSStepExecResult_Success
Else
msgbox "file is empty"

' Update the following task's precedence constraint
' - Execution status of inactive
'the precedence for both PBasis and Value is set to 0

msgbox(oStep.PrecedenceConstraints(1).PrecedenceBa sis)
msgbox(oStep.PrecedenceConstraints(1).Value)

oStep.PrecedenceConstraints(1).PrecedenceBasis = _
DTSStepPrecedenceBasis_ExecResult
oStep.PrecedenceConstraints(1).Value = _
DTSStepExecStat_Inactive

End If
Else

Main = DTSStepScriptResult_DontExecuteTask

End If

Set oFSO = Nothing

End Function


If (parameter = desired_results) Then
Main = DTSTaskExecResult_Success
else
Main = DTSTaskExecResult_Failure
end if

set your workfloe arrows to something on failure and on another for success


Quote:

Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default RE: how to skip a task in DTS - depending on criteria - 01-07-2006 , 05:43 AM



So the way I would do this is I would check the row count in an ExecuteSQL
task and assign the value to a Global variable. I would then from that task
have an Active Script task that asked if the value of the variable was >
0. If it was not then I would do something similar to this article

http://www.sqldts.com/default.aspx?246

The subject says skip whereas the text suggests simply disabling. If you
actually want to skip tasks then have a look at this article

http://www.sqldts.com/default.aspx?214

Allan



Quote:
"Raj" wrote:

Hi,

Im having trouble de-activating a task (DTSStep_DTSDataPumpTask_1) if
a
certain datasource has no data in it.
The error which i am getting is: Invalid Step Result Value.
Could anyway help?
Raj
This is the script i am executing:

Function Main()

Dim oFSO, File, oStep, oPkg, oDataPump

File = DTSGlobalVariables.Parent.Connections("D2RL
Copy").DataSource
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oPkg = DTSGlobalVariables.Parent
Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")

If oFSO.FileExists(File) Then

msgbox "exists"

If oFSO.GetFile(File).Size > 0 Then

Main = DTSStepExecResult_Success
Else
msgbox "file is empty"
' Update the following task's precedence constraint
' - Execution status of inactive
'the precedence for both PBasis and Value is set to 0
msgbox(oStep.PrecedenceConstraints(1).PrecedenceBa sis)
msgbox(oStep.PrecedenceConstraints(1).Value)

oStep.PrecedenceConstraints(1).PrecedenceBasis = _
DTSStepPrecedenceBasis_ExecResult
oStep.PrecedenceConstraints(1).Value = _ DTSStepExecStat_Inactive

End If
Else
Main = DTSStepScriptResult_DontExecuteTask

End If

Set oFSO = Nothing

End Function

If (parameter = desired_results) Then
Main = DTSTaskExecResult_Success
else
Main = DTSTaskExecResult_Failure
end if
set your workfloe arrows to something on failure and on another for
success




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.