dbTalk Databases Forums  

ActiveX Script Syntax

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


Discuss ActiveX Script Syntax in the microsoft.public.sqlserver.dts forum.



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

Default ActiveX Script Syntax - 08-31-2004 , 09:29 PM






Hello!

I have this ActiveX script, I need to pass these two files
names check and if they exist before I move onto a next
dts task, but I am having trouble checking both within the
Main function, is there a way to pass two file names as
parameters to a function and have a the the function
CheckFile check both, and if both exists go to next
DTS_Step

CONST FILE1
= "E:\WHC.DATA.FILES\EOM.AVG.DAILY.LOAD\FMSCURRENT.T XT"

CONST FILE2
= E:\WHC.DATA.FILES\EOM.AVG.DAILY.LOAD\FMSCOMPLETE.T XT

======================

Function Main()
Main = CheckFile(FILE1) "like (FILE1, FILE2)"...
End Function


Function CheckFile(sFileName)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function


Any help is highly appreciated!!





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

Default Re: ActiveX Script Syntax - 09-01-2004 , 12:13 AM






Why not use Global Variables?

CheckFile(DTSGlobalVariables("File1Name").Value).. ..........................
....

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"martino" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hello!

I have this ActiveX script, I need to pass these two files
names check and if they exist before I move onto a next
dts task, but I am having trouble checking both within the
Main function, is there a way to pass two file names as
parameters to a function and have a the the function
CheckFile check both, and if both exists go to next
DTS_Step

CONST FILE1
= "E:\WHC.DATA.FILES\EOM.AVG.DAILY.LOAD\FMSCURRENT.T XT"

CONST FILE2
= E:\WHC.DATA.FILES\EOM.AVG.DAILY.LOAD\FMSCOMPLETE.T XT

======================

Function Main()
Main = CheckFile(FILE1) "like (FILE1, FILE2)"...
End Function


Function CheckFile(sFileName)
Dim fso

Set fso = CreateObject
("Scripting.FileSystemObject")
If (fso.FileExists(sFileName)) Then
CheckFile = DTSTaskExecResult_Success
Else
CheckFile = DTSTaskExecResult_Failure
End If
Set fso = Nothing
End Function


Any help is highly appreciated!!







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.