Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parent/Child Package - Sharing Information

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I have a child package which sends email notification of success or failure, and is set to run after an ActiveX script. The precendence constraint will be "run on completion". The code in the child package is the same whether or not it is intended to sned success or failure notification. It therefore needs to no whether or not the preceding step succeeded or failed.
From experimentation, it appears that the child package cannot read the global variables from the parent package. So, how do child and parent packages share information, and how would a child package know the status of the previous step?
 
When sending global variables to a child package you must make sure that the child package uses the same case as the parent variables being sent in.

if you sent a global variable status you can't have Status in the child package.

You make the assignment using the Outer Package Global Variables tab in the sub packe properties.

Took me a bit of playing around and the case sensitivity kills me most of the time.

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Thanks for your time on this, but I am missing something here.

The Outer package GlobalVariable is called "Email_Failure_Subject" and it definitely has a value of "Oh no - it failed".
The Inner package GlobalVariable is called "Email_Failure_Subject" and it is set to have no value in the Inner Package Global Variables Tab. They both have the same case.

What I would like to set is set the value of the Inner Package Global varibale to whatever the value of the Outer Package Gloabl variable of the same name is. I intend to change the value of the outer variable on the fly in an activex script.


 
you don't even specify the Variable in the Inner Package Global Variable tab. you update the Global variable in the Parrent package and pass it through the Outer Package Global Variable. leave the Inner package tab empty.

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Now I get it ..thanks. The trick was to add the outer package variable to the "outer package variable" tab of the inner package properties, which I guess then makes it available to the inner package. This was the 'assignment' that you mentioned. Otherwise, they just sit in the drop-down list unassigned.
In the meantime, I have developed another method using the Package Object, which is more appropriate in some instances to exexute an inner package . I can call the sub from anywhere within the script to enumerate ADO errors. Put here for your reference.

Code:
Sub  Email_Status(myObject,Status, Step, StepLocation, Email_Extra_Text)

Dim objPackage
	
Set objPackage = CreateObject("DTS.Package")

objPackage.LoadFromSQLServer "YourServer", "", "", "256", _
, , , "DTS_Email_Completion_Status"

objPackage.GlobalVariables.Item("Email_Status").value = Status
objPackage.GlobalVariables.Item("Email_Step").value    =  Step
objPackage.GlobalVariables.Item("Email_Package").value =  DTSGlobalVariables("Package_Name").value
objPackage.GlobalVariables.Item("Email_Text").value = 
"The Package Status is : "
objPackage.GlobalVariables.Item("Email_Step_Location").value = StepLocationobjPackage.GlobalVariables.Item("Email_Extra_Text").value =Email_Extra_Text

objPackage.Execute
objPackage.Uninitialize()
Set objPackage = nothing
End sub
 
Glad it works.

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top