dbTalk Databases Forums  

Getting global variable from sub package

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


Discuss Getting global variable from sub package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gerhard Wessels
 
Posts: n/a

Default Getting global variable from sub package - 08-16-2005 , 07:00 AM






Hello All,

I need to execute a child package from a parent package and I need to get
the value of a global variable back from the sub package. The sub package
may modify the value of the global variable at runtime and I need to get
the modified value back after completion of the sub package. I am executing
the sub package with an ActiveX script because I know one cannot get values
back from the executed package when the Execute Package Task is used. My
problem is that I get the value of the variable as it was when the package
was saved, not the runtime value.

All I need is for the child package to be able to tell the parent whether or
not a specific step has executed in the child package.

Any help is appreciated.

Gerhard

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Getting global variable from sub package - 08-16-2005 , 01:24 PM






Can you not call the sub package through the object model in an Active
Script task and get the GV value that way?


"Gerhard Wessels" <gerhard (AT) eastmin (DOT) co.za> wrote

Quote:
Hello All,

I need to execute a child package from a parent package and I need to get
the value of a global variable back from the sub package. The sub package
may modify the value of the global variable at runtime and I need to get
the modified value back after completion of the sub package. I am
executing
the sub package with an ActiveX script because I know one cannot get
values
back from the executed package when the Execute Package Task is used. My
problem is that I get the value of the variable as it was when the package
was saved, not the runtime value.

All I need is for the child package to be able to tell the parent whether
or
not a specific step has executed in the child package.

Any help is appreciated.

Gerhard



Reply With Quote
  #3  
Old   
Gerhard Wessels
 
Posts: n/a

Default Re: Getting global variable from sub package - 08-17-2005 , 02:25 AM



Allan Mitchell wrote:

Quote:
Can you not call the sub package through the object model in an Active
Script task and get the GV value that way?
That is what I'm doing but the value for the GV I get is not the runtime
one, it's the one saved with the package, i.e. it is static.

Quote:

"Gerhard Wessels" <gerhard (AT) eastmin (DOT) co.za> wrote in message
news:uIuPjoloFHA.3316 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Hello All,

I need to execute a child package from a parent package and I need to get
the value of a global variable back from the sub package. The sub package
may modify the value of the global variable at runtime and I need to get
the modified value back after completion of the sub package. I am
executing
the sub package with an ActiveX script because I know one cannot get
values
back from the executed package when the Execute Package Task is used. My
problem is that I get the value of the variable as it was when the
package was saved, not the runtime value.

All I need is for the child package to be able to tell the parent whether
or
not a specific step has executed in the child package.

Any help is appreciated.

Gerhard


Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Getting global variable from sub package - 08-17-2005 , 01:05 PM



So I have a package and in there I have a GV. A Script task sets the value of the variable to Cstr(Now())

In my calling package I want to retrieve this value and it should change at every invocation. Here is what I do

Function Main()

dim pkg

set pkg = CREATEOBJECT("DTS.Package")

pkg.LoadFromStorageFile "c:\called.dts",""

pkg.execute

MsgBox pkg.GlobalVariables("InnerGV").Value

pkg.Uninitialize

Main = DTSTaskExecResult_Success
End Function


The result is different every time.


Allan



On Wed, 17 Aug 2005 09:25:11 +0200, Gerhard Wessels <gerhard (AT) eastmin (DOT) co.za> wrote:

Quote:
Allan Mitchell wrote:

Can you not call the sub package through the object model in an Active
Script task and get the GV value that way?

That is what I'm doing but the value for the GV I get is not the runtime
one, it's the one saved with the package, i.e. it is static.



"Gerhard Wessels" <gerhard (AT) eastmin (DOT) co.za> wrote in message
news:uIuPjoloFHA.3316 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Hello All,

I need to execute a child package from a parent package and I need to get
the value of a global variable back from the sub package. The sub package
may modify the value of the global variable at runtime and I need to get
the modified value back after completion of the sub package. I am
executing
the sub package with an ActiveX script because I know one cannot get
values
back from the executed package when the Execute Package Task is used. My
problem is that I get the value of the variable as it was when the
package was saved, not the runtime value.

All I need is for the child package to be able to tell the parent whether
or
not a specific step has executed in the child package.

Any help is appreciated.

Gerhard

Reply With Quote
  #5  
Old   
Gerhard Wessels
 
Posts: n/a

Default Re: Getting global variable from sub package - 08-19-2005 , 02:53 AM



Thanks for the help Allan. You're right it does work. I must have done
something else that is wrong. I'll check it out.

Allan Mitchell wrote:

Quote:
So I have a package and in there I have a GV. A Script task sets the
value of the variable to Cstr(Now())

In my calling package I want to retrieve this value and it should change
at every invocation. Here is what I do

Function Main()

dim pkg

set pkg = CREATEOBJECT("DTS.Package")

pkg.LoadFromStorageFile "c:\called.dts",""

pkg.execute

MsgBox pkg.GlobalVariables("InnerGV").Value

pkg.Uninitialize

Main = DTSTaskExecResult_Success
End Function


The result is different every time.


Allan



On Wed, 17 Aug 2005 09:25:11 +0200, Gerhard Wessels
gerhard (AT) eastmin (DOT) co.za> wrote:

Allan Mitchell wrote:

Can you not call the sub package through the object model in an Active
Script task and get the GV value that way?

That is what I'm doing but the value for the GV I get is not the runtime
one, it's the one saved with the package, i.e. it is static.



"Gerhard Wessels" <gerhard (AT) eastmin (DOT) co.za> wrote in message
news:uIuPjoloFHA.3316 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Hello All,

I need to execute a child package from a parent package and I need to
get the value of a global variable back from the sub package. The sub
package may modify the value of the global variable at runtime and I
need to get the modified value back after completion of the sub
package. I am executing
the sub package with an ActiveX script because I know one cannot get
values
back from the executed package when the Execute Package Task is used.
My problem is that I get the value of the variable as it was when the
package was saved, not the runtime value.

All I need is for the child package to be able to tell the parent
whether or
not a specific step has executed in the child package.

Any help is appreciated.

Gerhard


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.