Page 1 of 1

Passing declared local variables as input parameters

Posted: Mon Jan 27, 2020 3:58 pm
by juanlu
Hi,

1) I have a task TASK_CALLER and a task TASK_PROCESSOR.

2) In the task TASK_PROCESSOR, I have explicitly declared (edit task -> tab "local variables") the variable VAR_TEST_BOOLEAN. It is not initialised (VAR_TEST_BOOLEAN=)

3) In the task TASK_CALLER I have a Start Task action calling the task TASK_PROCESSOR: Start Task "TASK_PROCESSOR".

4) In the action Start Task "TASK_PROCESSOR" I am passing a input parameter: VAR_TEST_BOOLEAN=true

5) When I run the TASK_CALLER, the value of VAR_TEST_BOOLEAN is displayed as empty (!). I was expecting true.

6) If I removed the explicit declaration in TASK_PROCESSOR and then run TASK_CALLER again, then the value of VAR_TEST_BOOLEAN is displayed as true.

@Oleg: is this the expedted behaviour?

I was convinced that: I) whatever you declared was the default value and II) the value would be replaced by a calling/input parameter.

Kind regards, Juanlu.

Re: Passing declared local variables as input parameters

Posted: Tue Jan 28, 2020 10:46 am
by Oleg
is this the expedted behaviour?
Yes. Declaration hides the parameter with same name.
If you pass parameter you don't need variable declaration.
Declaration has the same effect as you set some value to variable at the 1-st step (before other steps of the task)

Re: Passing declared local variables as input parameters

Posted: Tue Jan 28, 2020 1:11 pm
by juanlu
Thanks for the reply.

I understand the principle. But I have to say that it is not ideal. In other scripting languages, tools, etc it is common to have default values for parameters, which are overriden when this parameters are passed (if they are not passed, then they take the default values).

Perhaps this could be suggestion for a future release...

Kind regards, Juanlu.