ssis if statement

I have an SSIS package in sql 2005.  I have a file watcher task that kicks off a for-each loop.  I want these tasks to run repeatedly until there are no more files.  It works for the most part, but I need to check the folder again after it does the for-each to see if any more files came in wile it was running BEFORE it executes the tasks outside of the for-each...follow?
LVL 6
PsychoDazeyAsked:
Who is Participating?
 
PedroCGDConnect With a Mentor Commented:
I made the project for you!
Change the paths of MDBfiles directory in each foreach loop
Helped?!
Regards

Inside srcipt task I added the follow code to count MDB files:
 
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
 
Public Class ScriptMain
    Public Sub Main()
        Dim i As Integer = CInt(Dts.Variables("uvCountMDBFiles").Value)
        Dts.Variables("uvCountMDBFiles").Value = i + 1
        MsgBox(i)
        Dts.TaskResult = Dts.Results.Success
    End Sub
End Class

Open in new window

LoadResponses2-dtsx.txt
0
 
PedroCGDCommented:
Creating another ForEach loop doesn't resolve your problem?!
Cheers!
Pedro
0
 
PsychoDazeyAuthor Commented:
Where would I put it?  do you know how to write an expression that counts the files with an .mdb extension in a certain directory?
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
PedroCGDCommented:
copy past the current foreach loop and link the old to the new one.
to count the number of files, use a script task.
I can do it for you, fo you want?
Regards
0
 
PsychoDazeyAuthor Commented:
yes, please help me with the task...I want to count the 8.mdb files after it exits the foreach loop...if there are more files it should run the for-each again, if not it should run the last 2 tasks.

Thanks again!
0
 
PedroCGDCommented:
Improvements?
Regards!
pedro
0
 
PsychoDazeyAuthor Commented:
I will be testing this afternoon, thanks again.
0
 
PedroCGDCommented:
improvements? :-)
Regards
0
 
PsychoDazeyAuthor Commented:
Hi Pedro-
I took what you gave me and modified it to work, i only used 1 for loop and counted the .mdb files each time it ran.  Thanks for the help, I appreciate it!
0
All Courses

From novice to tech pro — start learning today.