May 15, 2008 at 10:16 am
AT First, Sincere appology to all, not being able to COde things. I am very poor at code. not so good knowledge about VB or Active X. I have this (code Below) Active X script task in DTS , and i AM moving to SSIS. My Active X task fails. ( Many of u are asking why u r using ACtive X in SSIS). simple answer . Poor at coding. I need help --If some one can code this one for me in Script task. ANy help will be highly appreciated. Or someone can understand the logic behind the code and give me alternatives. If i can do the same piece of work with combining mnay others tasks.
Or som eone can write code for me in Script task and give me mor ehints to complete.
Thnaks to all in ADVANCE>
May 15, 2008 at 1:14 pm
You forgot to put the code...
-V
May 15, 2008 at 2:20 pm
SORRY.......
Here is the code---------
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim fso
Dim fil
Dim fold
Dim coll
Dim CurrentDate
Dim i
Dim arrFiles()
Dim pkg
Dim stpContinue
Dim stpStop
set fso = CREATEOBJECT("Scripting.FileSystemObject")
set fold = fso.GetFolder(DTSGlobalVariables("FilePathRoot").Value)
set coll = fold.files
CurrentDate = DatePart("m",Now) & "/" & DatePart("d",Now) & "/" & DatePart("yyyy",Now)
i = 0
set pkg = DTSGlobalVariables.Parent
set stpContinue = pkg.Steps("File Not Found Message")
set stpStop = pkg.Steps("Copy Files to CDJ")
If DTSGlobalVariables("ProcessFlag").Value = 0 Then
For each fil in coll
If DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified) = CurrentDate Then
ReDim Preserve arrFiles(i)
arrFiles(i) = fil
i = i + 1
fil.Copy(DTSGlobalVariables("TempFolder").Value)
End If
Next
'MsgBox(i)
If i = 0 Then
stpStop.DisableStep = True
'stpContinue.ExecutionStatus = DTSStepExecStat_Waiting
stpContinue.Execute
Else
'stpStop.ExecutionStatus = DTSStepExecStat_Waiting
stpStop.Execute
stpContinue.DisableStep = True
End If
End If
If DTSGlobalVariables("ProcessFlag").Value = 1 And DTSGlobalVariables("FromDate").Value <> DTSGlobalVariables("ToDate").Value Then
stpContinue.DisableStep = True
stpStop.DisableStep = False
For each fil in coll
If DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified) >= DTSGlobalVariables("FromDate").Value Or _
DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified) <= DTSGlobalVariables("ToDate").Value Then
'MsgBox(fso.GetFileName(fil) & " " & DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified))
fil.Copy(DTSGlobalVariables("TempFolder").Value)
End If
Next
End If
If DTSGlobalVariables("ProcessFlag").Value = 1 And DTSGlobalVariables("FromDate").Value = DTSGlobalVariables("ToDate").Value Then
stpContinue.DisableStep = True
stpStop.DisableStep = False
For each fil in coll
If DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified) = DTSGlobalVariables("FromDate").Value And _
DatePart("m",fil.DateLastModified) & "/" & DatePart("d",fil.DateLastModified) & "/" & DatePart("yyyy",fil.DateLastModified) = DTSGlobalVariables("ToDate").Value Then
fil.Copy(DTSGlobalVariables("TempFolder").Value)
End If
Next
End If
Main = DTSTaskExecResult_Success
End Function
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply