Monday, March 12, 2012

package configuration for generic pathnames and specific filenames

It's very easy to make a generic xml configuration file for the connection to the database for all packages my project contains. The connectionstring is the same for all these packages

Now I want to do the same for all flat file sources I have in my project where the connectionstring is not the same for all packages.

For example I use the following flat files in my project:

c:\AAA.txt

c:\BBB.txt

c:\CCC.txt

If I move the packages to the production database the flat file sources are located in another directory.

So in fact for the flat file sources there is a generic part for all files (in this case 'c:\ ') and a specific part ('AAA.txt', 'BBB.txt' and 'CCC.txt').

Can I indicate this in the package configurations sections? And how?

Thanks,

John

Create two variables in your package. One to hold the "generic" part of the path, the other to hold the specific part of the path. Include these two variables in your configuration file so that you can alter them.

Then using expressions on the flat file source, you can concatenate the two variables to form the full path, which is dynamically adjusted based on the configuration file.|||

Using expressions in combination with the variables solved my problem.

Thanks a lot Phil

No comments:

Post a Comment