Variables with Expression & Config
I am generating the Output-Path for FlatFiles dynamically.
I require a file name of the form YYMMDD_name.txt.
For testing purposes I optionally generate the alternative version TEST_name.txt.
I can change the setting from Test to YYMMDD(Release) using a boolean in a config file.
This works pefectly using Expressions from within Visual Studio.
I have two config files, one for TEST and one for YYMMDD.
dtexec /File Package.dtsx /Conf TEST.dtsConfig
dtexec /File Package.dtsx /Conf YYMMDD.dtsConfig
I am now executing the YYMMDD version from command line (Config Value Test=0).
I then get some files of the form TEST_name.txt and some with YYMMDD_name.txt.
I believe the config is not loaded properly until the process has nearly completed.
Out of 20 files a maximum of 5 were generated correctly, mostly 0-3.
Does this ring a bell? I am rather confused and have no idea what to do.
September 28th, 2010 12:31pm
seems like specifying the alternative config file did not work.
I am not sure if having the project open might of also had an influence.
However it is working now and the weird results I was getting with half good half bad just went away.
Can't say the issue is solved forever but for now it seems ok...
Free Windows Admin Tool Kit Click here and download it now
September 28th, 2010 1:23pm
Im not very clear as to what you were trying to do.
Tweet me..
September 28th, 2010 2:57pm
problem has turned up again...
I'll try to clarify what I am doing:
Im am generating 20 different flat files from a t-sql database. the file generation works fine.
these 20 files must be stored with a filename that is generated using an expression.
@[User::OutputPath] + "\\" + @[User::Prefix] + @[User::_FormatDate] + "Name.txt"
"OutputPath" and "Prefix" are read from a Config-File, "_FormatDate" is generated either from the current date, or from date variables defined in .bat call. The call looks something like this:
dtexec /File Package.dtsx /Set \package.variables[Year].Value;2005 /ConfigFile Config.dtsConfig
a file that is generated with this call should look like this:
OutputPath\Prefix2005Name.txt
most of them do, but some look like this:
OutputPath\Prefix2010Name.txt
with other words the "/Set \package.variables[Year].Value;2005" does not seem to come into effect right away, but after the process has already written a few files. It always only goes wrong with the files written first, so it seems to update the expression
too late.
I have tried quite a few things to get things right, I am currently thinking about using a ScriptTask to set the value, as expressions just don't seem to work as I would expect them to. I have already tried using a ScriptTask and simply passed the variables
using expressions, hoping that this would force them to update, this did not work.
Any ideas would be greatly appreciated!
Free Windows Admin Tool Kit Click here and download it now
November 24th, 2010 9:28am