DTSX parameter not getting /SET when expression is used for default.
on VS2008 SS 2008R2 - When I create a variable for my "startDate" and use the /SET command on the command line the variable gets set when I use a static default value or a blank default value for the variable but not when I set the expression to: (DT_WSTR,30)(DATEADD("MM",DATEDIFF("MM",(DT_DATE)"1/1/1900",GETDATE())-1,(DT_DATE)"1/1/1900")) When I use the above, which is what I do want the default to be, my /SET command is ignored and the above result is ALWAYS used. I have verified this from multiple angles. If I put a static date value in, ie: 2011-05-01 00:00:00 that value works fine and as expected gets overridden if I specify it differently with /SET. However, using the exact same command line that worked to override the static value results in always using the result of the expression if the default is set to the expression. Is that clear?
June 27th, 2011 7:48pm

If what you're saying is that you can't /SET a variable that has an expression on it... you're 100% correct. You can't. The engine works like this: "The caller requested we push in a 'value' for variable startDate... so yes, set the 'value' to 'X'" "Task Y inside the package is requesting a 'value' from variable startDate. We have a value - but the variable is marked with 'EvaluateAsExpression' set to true... so ignore the 'value' and calculate one from the expression." Therefore, any "value" you place on a variable with an expression is wholly useless... Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2011 8:08pm

OK, I have found a workaround for this unwelcome behavior. I created a second variable called startDateP ... that I set to a static value of 'NS' which allows me to set that from the command line, then my original PITA startDate expression I modified like so: (@[User::startDateP]=="NS")?(DT_WSTR,30)(DATEADD("MM",DATEDIFF("MM",(DT_DATE)"1/1/1900",GETDATE())-1,(DT_DATE)"1/1/1900")):@[User::startDateP] That ugly mess is a conditional which basically says that if the startDataP parameter is still 'NS' it means that no date was passed and to use the expression, otherwise use the parameter passed in starteDateP. Hackish, but it does do what I need.
June 27th, 2011 9:44pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics