![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Using 2005, SSIS... OK - I'm trying to loop through all the *.txt files in a certain directory, and using each filename, call an executable, passing the filename as an argument to the executable. I started by adding a foreach loop container, and made sure it was foreach file enumerator type. I chose the appropriate directory, and put in my *.txt filter, and chose to use the fully qualified name. On the variable mappings page, I created a new variabe (User::FileName), and saved it. Then I added the execute process task inside the for each loop container, calling the executable in the execute process task. I then chose the User::FileName variable as the StandardInputVariable. And it won't work. It can't find the filename at all. It does it 3 times (which is the # of files) but it's not finding the filename. What do I need to do in order to get the filename passed to the executable??? |
#3
| |||
| |||
|
|
Hello Corey, So are you saying that the variable does not contain the value or that the ExecuteProcess task is unable to use it? If the former then have a look at this article in which we discuss doing what you are trying to do http://www.sqlis.com/default.aspx?55 You could add a breakpoint on the ForEach enumerator to break on each iteration of the loop. This way you can use a watch to find out wht value is being stired in the variable. Allan Mitchell www.SQLDTS.com www.SQLIS.com www.Konesans.com Using 2005, SSIS... OK - I'm trying to loop through all the *.txt files in a certain directory, and using each filename, call an executable, passing the filename as an argument to the executable. I started by adding a foreach loop container, and made sure it was foreach file enumerator type. I chose the appropriate directory, and put in my *.txt filter, and chose to use the fully qualified name. On the variable mappings page, I created a new variabe (User::FileName), and saved it. Then I added the execute process task inside the for each loop container, calling the executable in the execute process task. I then chose the User::FileName variable as the StandardInputVariable. And it won't work. It can't find the filename at all. It does it 3 times (which is the # of files) but it's not finding the filename. What do I need to do in order to get the filename passed to the executable??? |
#4
| |||
| |||
|
|
Nice article - I've done everything you did in your article, up until the last part, concerning the expression & tying the expression to a variable. Do I need to do this? I thought in the execute process task, it would just use the variable in the StandardInputVariable property, which was my variable..... To answer your question though - the variable does not contain the value, resulting in the ExecuteProcess task being unable to do anything with it. It's just an empty string, b/c when I look at the far right tab, the processing results (or whatever it's called), the error is basically... "C:\path\program.exe" "" had trouble executing or something remotely similar - sorry - not at my the same machine now. In the empty double quotes above, there should be a filename, such as: "C:\path\program.exe" "C:\path\testfile.txt" Basically my package succesfully is... 1) enumerating the correct number of files 2) performing the execute process task (i.e. the program opens) ...but the filename is never there. Allan Mitchell wrote: Hello Corey, So are you saying that the variable does not contain the value or that the ExecuteProcess task is unable to use it? If the former then have a look at this article in which we discuss doing what you are trying to do http://www.sqlis.com/default.aspx?55 You could add a breakpoint on the ForEach enumerator to break on each iteration of the loop. This way you can use a watch to find out wht value is being stired in the variable. Allan Mitchell www.SQLDTS.com www.SQLIS.com www.Konesans.com Using 2005, SSIS... OK - I'm trying to loop through all the *.txt files in a certain directory, and using each filename, call an executable, passing the filename as an argument to the executable. I started by adding a foreach loop container, and made sure it was foreach file enumerator type. I chose the appropriate directory, and put in my *.txt filter, and chose to use the fully qualified name. On the variable mappings page, I created a new variabe (User::FileName), and saved it. Then I added the execute process task inside the for each loop container, calling the executable in the execute process task. I then chose the User::FileName variable as the StandardInputVariable. And it won't work. It can't find the filename at all. It does it 3 times (which is the # of files) but it's not finding the filename. What do I need to do in order to get the filename passed to the executable??? |
![]() |
| Thread Tools | |
| Display Modes | |
| |