Loading project variables from the command line

I’m attempting my first Automise project, which is to automate an SQLBackup (using red-Gate software’s SQLBackup tool) of a given MSSQL database to a file. The database, server, target folder and filename I want to be dynamic, loaded into project variables from the commandline.

I’ve created the project, and given my variables initial values. Whenj the job runs interactively, all works well. When run from the commandline (using atcmd to run the project), it also works well, if it uses the initial values for the variables. When I pass in the variables from the commandline, using the /V switch, although the output text says that the variables are being given the supplied values from the command line, the job fails because the command used to perform the backup, which is itself a variable (with the macro property ticked) built from the contents of the variables, contains the initial values, not the supplied values. It seems not to be being re-evaluated.

So, I guess my questions are:

At what point are the project variables with the macro property ticked re-evaluated? Before or after the passed in values are attributed to their project variables?

Is there something else obvious I’m missing here?

BTW I really like the product, and can see lots of uses for it.

Thanks

David Cook

Hi David

This looks very much like a bug that was fixed in December last year. Which version/build of Automise are you using? Build 1.5.0.317 (the most recent 1.x build) has the fix included, as does the current version of Automise 2.x

I should be on the latest. Help/About says 2.0.0.74.

I’ve changed my approach a bit. I’m specifically loading the derived-variables from the passed in parameter-variables (using the set variable action) before executing any task; I’ll send myself an email with all of the values after this, and see whether the expected values are there.

I’ll let you know …

Hi David,

If you’re seeing it in the latest 2.0 builds, it’s definitely a bug. Is there any chance you could send your project to us at support (support at automise dot com) so we know what to do to reproduce it?

BTW, an alternative to setting up an email action would be to use the “Log Variable Values” action and then reopen the project and look through the Run History, to see what the values were.

Regards,

Angus

I’ve sent a zip file containing the project, a batch file used to run it, and a log of the output showing the variables being given values from the command line, but then later retaining their initial values at creation. Hope that helps!

BTW, in the topic “Passing variables to included script” in this forum the behavior described there is exactly what I am seeing in my issue. FWIW.

Just to complete the resolution of this issue, I sent a file containing the project to the tech guys, and received the following reply:

 

Thanks for sending these. The problem is actually that you have set "Macro" on the variables which you are setting from the command line.

Macro actually means "Ignore the current value, and recalculate the current value from the Default Value each time the variable is accessed." It makes the variable into a function, based on its default value.

The bug is that Automise appears to let you set the variable, even though it's not actually changing anything (because Macro variables don't have current values.)

The workaround for now is to disable Macro on all the variables apart from SQLCommand and TargetConnStr. Then the project should work as you expect.

We'll update Automise so that it is clear about whether or not you can set Macto variables.

 

So, it appears that the issue was my using "macro" setting for my variables, and not correctly understanding the way they work. I'm not sure I agree with the statement "it makes the variableinto a function based on its default value"; to my mind, it makes the variable into a constant, and that's how I will treat them from now on.

Hi David

They are not constants if their default value references other variables… and the value of those referenced variables changes at runtime.

HTH