dbTalk Databases Forums  

ActiveX Task - Reference to Itself

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ActiveX Task - Reference to Itself in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob St. Aubyn
 
Posts: n/a

Default ActiveX Task - Reference to Itself - 08-04-2005 , 10:29 AM






Greetings all.

SQL Server 2000, sp3a

Trying to concoct an ActiveX script task that is a generic error processor -
taking the exception file(s) and description of the task that just failed
(the previous step in the workflow) and dynamically adjusting properties on
the SendMail task to attach the exception files and include error detail (the
next step in the workflow).

I have it written and working great. The only catch is that, in its current
form I have to explicitly set constants in its code to the name of the
previous and subsequent steps in the workflow so I can retrieve data and/or
adjust properties in them. It seems logical to me that an executing ActiveX
task ought to "know" what its own name is. If I were able to retrieve the
name of the step from its own code, it would be easy enough to then derive
the step name that's downstream from its precedence constraint, find the step
whos constraint is set to it, and make the code completely generic. Sadly, I
haven't found any way for an executing step to set a reference to itself at
run time.

I use this step in about 100 different places in the package and that's what
is driving the need to make it generic. Would be great if I could just cut
and paste it each time I need to add a new section to the package. Plus it
would eliminate the possibility of a typo in hard-coding the step names.

Thanks in advance for any advice!

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: ActiveX Task - Reference to Itself - 08-04-2005 , 10:42 AM






There is no Me or this equivalent to get the step. The best you could do
would be to enumerate steps, looking for a currently executing steps. Relate
that step to a task, and see if it is an ActiveX Script Task, perhaps even
check the script code itself for a tag that indicates it is the error
handler code. Not fool proof but the best I think you will get.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com
"Bob St. Aubyn" <BobStAubyn (AT) discussions (DOT) microsoft.com> wrote

Quote:
Greetings all.

SQL Server 2000, sp3a

Trying to concoct an ActiveX script task that is a generic error
processor -
taking the exception file(s) and description of the task that just failed
(the previous step in the workflow) and dynamically adjusting properties
on
the SendMail task to attach the exception files and include error detail
(the
next step in the workflow).

I have it written and working great. The only catch is that, in its
current
form I have to explicitly set constants in its code to the name of the
previous and subsequent steps in the workflow so I can retrieve data
and/or
adjust properties in them. It seems logical to me that an executing
ActiveX
task ought to "know" what its own name is. If I were able to retrieve the
name of the step from its own code, it would be easy enough to then derive
the step name that's downstream from its precedence constraint, find the
step
whos constraint is set to it, and make the code completely generic.
Sadly, I
haven't found any way for an executing step to set a reference to itself
at
run time.

I use this step in about 100 different places in the package and that's
what
is driving the need to make it generic. Would be great if I could just
cut
and paste it each time I need to add a new section to the package. Plus
it
would eliminate the possibility of a typo in hard-coding the step names.

Thanks in advance for any advice!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.