Showing posts with label onvariablevaluechanged. Show all posts
Showing posts with label onvariablevaluechanged. Show all posts

Friday, March 9, 2012

OnVariableValueChanged event

BOL states about the OnVariableValueChanged event that it is fired by an executable, in other words not by the variable itself (http://msdn2.microsoft.com/en-us/library/ms140223.aspx)

This kind of makes sense because all events have to be fired by executables so that they can be caught by eventhandlers scoped to those executables. But it leaves me asking a few questions.

If the event is fired by an executable, is the code that fires the event part of the DTSContainer class?

How does the executable know that a variable has been changed? In other words, if I am building a custom task/component, do I have to explicitly fire the OnVariableValueChanged event if I know that the task/component I am building is going to change a variable?

Or will the SSIS runtime know that the variable has been changed.

If the answer to that last question is "yes", how does the executable know that the variable has been changed?

Is what BOL says leading me astray a little here?

Thanks in advance.

-Jamie

Jamie, the BOL topic is accurate but incomplete. The event is actually fired by the variable, but it is only visible at the container level because that is where events are surfaced. You don't have to do anything other than ensure that the FireVariableValueChanged (can't remember actual name) property is set to true.

Variables tell their container parent that they are changes via internal code paths that aren't visible to the end user. This is part of the implementation of the runtime.

Variable value is changed

Variable tells parent container

Container fires VarValChanged event

Kirk Haselden
Author "SQL Server Integration Services"

|||

Aha. Now that's interesting. So take the following scenario:

MyVariable (that has RaiseChangedEvent=TRUE) is scoped to a sequence container|||

Jamie,

Yes, that's right.

You should stop being lazy and try it.

It should work that way as well. :)

Thanks,

K

OnVariableChangedEvent Log Message

I have posted a very simple request to have the message in the SSIS log from an OnVariableValueChanged Event to include the vale the variable has been set to.

If you like the idea of this enhancement please go and vote and validate it here

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=238803

Phil,

What does it have in there currently?

-Jamie

|||Just the name of the variable that changed