Question : SSIS For Loop Problem

I have an SSIS package which (among other things) checks to see whether a file has been posted on an SFTP server. To do this I am launching WinSCP via an execute process task.

So all is good until the file does not appear on the target server in which case the whole package fails.

What I would like it to do is check and check until it finds the file or it has checked X times. I have tried putting this into a For loop but I can't seem to get it to work.

Is there a better way to do this? How would I get the loop to continue until Eval = 10 or Execute Process = Success?

Thanks

Mike

Answer : SSIS For Loop Problem

Check out the following link:

http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis

What you need to do to avoid having the package thrown off of the bus when the file doesn't exist is to first check to see if it does exist, which is covered by that link.

In order to handle the need to attempt to find the file X times, you are probably going to want to add some sort of delay after each of the first 9 failed attempts to find the file (otherwise, you'll do your X times in about X*10 microseconds ;-).  However, THat being said, basically you need to have a FOR LOOP that impacts 2 variables, one to count the number of times you loop and the other to contain some sort of indicator that you have or haven't finally found the file.

I'd probably check for a LoopCount >> 10 and, if true, fail the component and, thereby, the package if the file has not been found.  If the file is found at some point (say, pass number 4), then I'd set the FileFound indicator and then set the LoopCount to 11.  

Random Solutions  
 
programming4us programming4us