November 25, 2018 at 1:49 pm
I need in my package to make sure that the destination folder contains no .xlsx files, and then depending on that direct my further flow accordingly.
SSIS VS 2015: What SSIS task should i use to check whether there is any Excel file in a target directory where my package will write data to?
Likes to play Chess
November 25, 2018 at 3:36 pm
Personally, rather than using a Script Task and coding manually, I would use a For Each Loop. Then, if you enter the loop, you know that there are files. If you don't, there aren't.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 25, 2018 at 4:06 pm
Thom A - Sunday, November 25, 2018 3:36 PMPersonally, rather than using a Script Task and coding manually, I would use a For Each Loop. Then, if you enter the loop, you know that there are files. If you don't, there aren't.
This is also how I would handle it.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
November 25, 2018 at 6:36 pm
Sounds neat. thanks. and to check whether the loop has been entered i just put a script task into it and assign = 1 to a variable that =0?
Likes to play Chess
November 26, 2018 at 1:36 am
VoldemarG - Sunday, November 25, 2018 6:36 PMSounds neat. thanks. and to check whether the loop has been entered i just put a script task into it and assign = 1 to a variable that =0?
Use an Expression task, not a script task; again, far easier. 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 26, 2018 at 5:19 am
VoldemarG - Sunday, November 25, 2018 6:36 PMSounds neat. thanks. and to check whether the loop has been entered i just put a script task into it and assign = 1 to a variable that =0?
Why do you need to do this?
If you put a task in the FEL and it executes, the loop has been entered.
Tasks in the FEL will not execute if the FEL has not been entered. No need for any checks, unless, perhaps, you are doing something additional outside of the loop.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
November 26, 2018 at 5:35 am
Phil Parkin - Monday, November 26, 2018 5:19 AMVoldemarG - Sunday, November 25, 2018 6:36 PMSounds neat. thanks. and to check whether the loop has been entered i just put a script task into it and assign = 1 to a variable that =0?Why do you need to do this?
If you put a task in the FEL and it executes, the loop has been entered.
Tasks in the FEL will not execute if the FEL has not been entered. No need for any checks, unless, perhaps, you are doing something additional outside of the loop.
Difference here, Phil, is the OP wants to do something if there are no files, not if there are. The task can't be inside the For Each, as the fact that the Container has been entered means that they don't want to said process. So there needs to be something like an Expression Task in the For each (that changes the value of a boolean variable to True, for example) and then the On Success Flow to the next task (after the For Each Container) will be on success and that the value of said variable is false.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
November 26, 2018 at 6:08 am
Thom A - Monday, November 26, 2018 5:35 AMDifference here, Phil, is the OP wants to do something if there are no files, not if there are. The task can't be inside the For Each, as the fact that the Container has been entered means that they don't want to said process. So there needs to be something like an Expression Task in the For each (that changes the value of a boolean variable to True, for example) and then the On Success Flow to the next task (after the For Each Container) will be on success and that the value of said variable is false.
Yup, it appears I wrote my reply while being less than fully awake!
As you suggest, it would seem that the best solution is to create a Boolean variable 'HasFiles', default 'false' and to use an expression inside the FEL to set it to 'true'.
After the FEL, use appropriate 'Expression and Constraint' precedence constraints to direct the flow.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply