Toad World® Forums

Passing Variable Values from Parent to Child

Is it possible to pass variables that are defined and have their values set in the Parent automation be passed to the Child automation?

A real world example: I have lots and LOTS of Toad automations, and I want to start logging details about them into a database. However, I don’t want to have to create a child automation for every single parent automation - logically there’s no reason for that.

Instead, I should be able to create one child automation that handles the inserts and updates to the logging database that I can then call from all of my parent automations, and pass along the variables as needed that contain the parent-specific details.

This is easily done in other work flow packages, so I’m thinking that there must be a way to do it in Toad and I’m just missing it.

Unlike Run Program, I don’t see any Arguments line to pass in parameters. Also, I don’t see a way to call a Toad automation script from the command line and pass in arguments as I don’t see how to cpature a passed in parameter. I do know you can have a generic routine to write out variables to a database and you can save it as a template. Make an execute script step that writes the variable out to your database (you will need to use the same variable name(s) or pairs of names, one to hold the variable name and one to hold the value) and then save it as a template. Then at the bottom of the toolbox you can just drag that template into each automation job. Still requires you to make generic variable names that get loaded from whatever variables you are already using in each automation job. Best I can think of.

I believe it would be useful for future to expand the “Run automation script” activity.

Have you tried using global bind variables?

EDIT: not sure why the screenshot is not visible… You can define global variables in the Project Manager tab, there is a small button on the right side of that pane (the icon looks like th**is: ( x ) = )

Hi Martin,

No, I haven’t, because I don’t have any of my automations organized into projects. Based on what I’ve seen so far, Projects are only going to add yet another file to maintain along with the core .tas file - and since there is still no native support for TFS or Git, adding extra files to the mix isn’t viable across all of our automation scripts.

The project manager is just where we put the global variable editor. (Don't ask me why as I can't remember[:O]) We are not suggesting to use projects. We are suggesting that we have the concept of variables that are available to all areas of the product. Se image. These are mainly for sql bind vars. I am not sure about the user of them in filenames, etc. Give them a try.

After i defined some variables in this window (let’s say myTestVar) i was then able to use it as a standard variable in automation… For example in the “Select to file” activity’s output excel file filename: “c:\temp\dir1\ReportXYZ_#myTestVar#.xlsx”…

The good thing about globals variables is that they are saved into a file so you can still access them the next time you open toad…

Debbie - Oh, ok. Thank you for clarifying!

Martin - What file are the global variables saved in? The Toad automation file, or some user data file? I’m asking because I develop on my laptop, but then deploy to a different machine to actually schedule and run under a different user. Anything that’s tied to me specifically or not embedded isn’t going to work for the way our environment is configured.

Go to your AppData dir (Menu - Help - About - Application Data Directory link) and then in the “GlobalVariables” folder there is a xml file for them.

my path is this:

c:\Users\mholkovi\AppData\Roaming\Quest Software\Toad Data Point 4.2\GlobalVariables\GlobalVariables.xml

Ok, so to use global variables I’d have to keep that file replicated to every machine that the automations execute on.

That is true