October 13, 2006 at 7:30 am
Hi,
I am trying out ideas for using package configurations and in that process I ran into some problems with using variables that I don't quite understand.
I have a set of files stored in a folder and my foreach loop container iterates over a subset of those files using wildcard specifications on the filename and a variable mapping which is then used by the file connection manager to reference the actual files. Pretty standard.
I have several of those foreach loop container where each loops over a subset of the files in the same folder. So naturally I now wanted to have a variable to specify the root folder also. This is in short my problem actually since:
1) I cannot insert the root folder variable instead of a hardcoded enumerator configuration folder and get a valid reference
2) I cannot leave the enumerator configuration folder specification empty and just create the full path in the file connection manager using the combination of the file reference passed from the foreach loop container and the root folder variable. This will additionally set of warnings on the foreach loop container.
So I am wondering how this can be done. I have around 15 subsets of files I need referencing so it quickly becomes very relevant to be able to do.
It would be optimal to use package configurations to avoid having to change the same folder location 15 times each time the package is moved to a different environment where the folder reference is not identical.
Any ideas will be much appreciated.
Thanks,
Casper
October 18, 2006 at 6:39 am
The way I've gotten around being able to set the root folder is this.
I create a Global Package variable and set a default value of whichever folder I want. Then I create a Script Task which goes in and sets the REAL value of the root folder. After that, I reference the variable. Since it has a default value in it, it doesn't error out on me when I'm debugging or running the package.
I do the same thing with Flat File Connectors too. I set a value to an existing folder/file (even if it's just a dummy file kept in the folder). Then I use the Expressions on that Connector to set the real connection string to the value of the variable in my variables list.
Works like a charm for me. @=) Hope it helps you out as well.
October 19, 2006 at 12:41 am
Hey,
Thanks for the answer. I found the expressions item in the foreach loop container finally so I got it working very similar to your setup. I have a global package variable that I set in the package configuration file which stores the folder root path.
As an extension to this I can also mention that in your setup you shouldn't have to set a default value so that it doesn't error you out. On the properties of the foreach loop container you should be able to set the "DelayValidation" to true. This way it won't validate the container before after replacing the variable with the directory path and no errors should occur. This is how I set it up now and it works ok.
Thanks for helping,
Casper
October 19, 2006 at 4:15 am
Thanks for the info, Casper. I'm still learning this stuff myself, so every bit of info is incredibly helpful.
Glad you got yours working.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply