cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
zhiyangchen
Level 6

How to set IA variables in Execute batch action

Hi everyone,

Does anybody know how to set IA variables in Execute batch action? So I can add dispaly message with rule later.

Thanks!
Labels (1)
0 Kudos
(8) Replies
pv7721
Level 20

You simply use IA variables, like $SOME_VARIABLE_NAME$, but don't forget to replace them before executing the batch file!
0 Kudos
zhiyangchen
Level 6

sorry, still don't understand. For example, I add excuting batch action with code
perl -v
if [ $? -eq 0];
then
export $flag$=0(it doesn't work here)
fi
0 Kudos
pv7721
Level 20

I suspect that your code should be rewritten into:

[CODE]perl -v
if [ $DOLLAR$? -eq 0];
then
export $DOLLAR$flag$DOLLAR$=0(it doesn't work here)
fi[/CODE]

And have the IA variables to be replaced BEFORE the code execution. But on the other hand, what you might not be aware of, is that IA variables are understood only by IA, so even if you execute your Perl script, at the time of the script execution, the IA syntax variable would be meaningless to the script.
0 Kudos
zhiyangchen
Level 6

I will try it. I don't want to make script understand the IA variable but want ot set variable $falg$ to 0, so I can display message next with rule to check $flag$ is 0 or not.

BTW, could you explain "have the IA variables to be replaced BEFORE the code execution"? I want to set IA variable not get it's value.
0 Kudos
pv7721
Level 20

Ok, I think this would be like the 2nd time I'm trying to explain to you: it doesn't work like you would expect (i.e. you cannot set an IA variable (one that is surrounded by dollars) in a PERL script, EVEN if you run the script WITHIN IA! It simply doesn't work this way, usually people use IA variables, for variable things, like $USER_INSTALL_DIR$ which are replaced BEFORE running the script. From what the script looks like, you may want to do something a little different: if the thing is zero, set the return value to 0 or something different than 0 in the other case, and if you look closely, you see that the returned exit code is by default stored in the $EXECUTE_EXITCODE$ variable.
0 Kudos
zhiyangchen
Level 6

Hi, sorry, I think maybe I am not clear in the question. Actually I add action to execute batch in installer, and in this action I call a perl script and then check it's return code. I am not going to set IA varialbe in perl but in the batch action. I think this may much easy for you to answer. If the return code is zero, I want to use $flag$ to be 0 and then I can check this variable later. But right now it doesn't work no matter I add "$flag$=0" or "$DOLLAR$flag$DOLLAR$=0" in the execute batch script action.
0 Kudos
zhiyangchen
Level 6

I find the answer finially. The exit code and stdout can be saved as IA variable in the action setting.
0 Kudos
pv7721
Level 20

zhiyangchen wrote:
I find the answer finially. The exit code and stdout can be saved as IA variable in the action setting.


This was precisely what I was trying to explain in my previous post! 🙂
0 Kudos