Hi,
I'm trying to enable Expression for a custom property in my custom data flow component.
Here is the code I wrote to declare the custom property:
public override void ProvideComponentProperties()
{
ComponentMetaData.RuntimeConnectionCollection.RemoveAll();
RemoveAllInputsOutputsAndCustomProperties();
IDTSCustomProperty90 prop = ComponentMetaData.CustomPropertyCollection.New();
prop.Name = "MyProperty";
prop.Description = "My property description";
prop.Value = string.Empty;
prop.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
...
}
In design mode, I can assign an expression to my custom property, but it get evaluated in design mode and not in runtime
Here is my expression (a file name based on a date contained in a user variable):
"DB" + (DT_WSTR, 4)YEAR( @.[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @.[User::varCurrentDate] ), 2 ) + "\\" + (DT_WSTR, 4)YEAR( @.[User::varCurrentDate] ) + RIGHT( "0" + (DT_WSTR, 2)MONTH( @.[User::varCurrentDate] ), 2 ) + ".VER"
@.[User::varCurrentDate] is a DateTime variable and is assign to 0 at design time
So the expression is evaluated as: "DB189912\189912.VER".
My package contains 2 data flow.
At runtime,
The first one is responsible to set a valid date in @.[User::varCurrentDate] variable. (the date is 2007-01-15)
The second one contains my custom data flow component with my custom property that was set to an expression at design time
When my component get executed, my custom property value is still "DB189912\189912.VER" and I expected "DB200701\200701.VER"
Any idea ?
Are you certain that the data flows are being executed in the order you expect?
What is the scope of your variable?
I tried a test case with 2 data flows connected to each other in the control flow. In the first, I had a row count transform populate a variable (of package scope). In the second, I set a dataflow property expression to use the variable, and confirmed that it did use the value set by the Row Count, so it seems your scenario should work...
Mark
|||Sorry,
You're right.
I was confused because even in debug mode (when execution is interupted with a DataViewer), the property value was "DB189912\189912.VER"
So I have added a ComponentMetaData.FireInformation with the property value, and the value was "DB200701\200701.VER"
Next time, I will start with the ComponentMetaData.FireInformation... ;-)
Sorry again
Thanks a lot
|||No problem, glad to hear you have it working!
No comments:
Post a Comment