Dts Events FireInformation

  • The story so far...

    I am trying to capture the values of variables at the beginning of a package's execution. I can't use the OnVariableValueChanged event handler due to the way that that event is actually raised.

    I want to build a generic solution to be able to log variable values at any point during the package, and I have decided to use a script task to fire the OnInformation event.

    The signature of this method is:

    Dts.Events.FireOnInformation(informationCode as integer, subComponent as string, description as string, helpFile as string, helpContext as integer, fireAgain as boolean)

    My plan was to pass the variable value along to the event handler in the description parameter, and the variable name would go in the subcomponent parameter. The event handler would then pick these up in the System::SourceTask and System::ErrorDescription variables.

    However, it doesn't matter what value I put in the subComponent parameter, the SourceTask variable always contains the source task name. In fact, there aren't any variables that contain the value of the subcomponent parameter.

    My question is thus: where can I pick up the value passed via the subComponent parameter? And, if it is not possible, what is the point of having it there at all?

    Any help would be greatly appreciated as I have been scratching my head over this for a few days, now.

    Cheers,

    Tom

    Life: it twists and turns like a twisty turny thing

  • update: I know the event handler is consuming the subComponent parameter because it appears in the output text. I just cannot figure out how to get hold of that information for my own uses :angry:

    anybody got any ideas?

    Tom

    Life: it twists and turns like a twisty turny thing

  • it looks like I am unable to get access to the subcomponent information, so i have had to implement a clunky workaround joining and splitting strings.

    Life: it twists and turns like a twisty turny thing

  • Update:

    I have been able to solve this (after coming back to it after a little while) by using the dts.Events.FireCustomEvent method.

    The method's signature is: eventName as string, eventText as string, byRef arguments() as Object, subComponent as string, byRef fireAgain as boolean

    For the event name, use OnVariableValueChanged. The event text can be string.empty. SubComponent can be empty, but I use the name of the task. FireAgain I have set as true.

    The arguments parameter needs to be an object array containing the following four items: Variable Name, Variable ID, Variable Description and Variable Value.

    You can now fire this event even if the actual event would not get fired (i.e. if a variable is updated by a configuration at the start of the package execution).

    Hopefully, this may help someone else who has been scratching their head over this one.

    Tom

    Life: it twists and turns like a twisty turny thing

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply