Create Variable

<< Click to Display Table of Contents >>

Navigation:  Actions > Variables >

Create Variable


Creates a new variable when you run a task. If you create a variable and then use it in several different tasks, you can change the variable once and update every task at the same time.

The action allows to create both a global variable and a local one within a task. Local variables can also be generated by means of creating a list of local variables (see Local variables tab of task editor).




Variable Name

Enter the name of the variable you want to set the value of.


Variable Kind

Global variable (for all tasks) – in this case a global variable will be created. If the variable already exists, a specified value will be assigned to it.

Local variable (for this task only) – in this case a local variable will be created within a task. The local variable will be deleted from the memory automatically when the task is finished. See the chapter Local Variables for details about local variables.


Variable Value

Enter the value that you want to set for the variable.


Expand variable value.

If this parameter is on, RoboTask computes the value of an expression (that is, expands variables in the expression) before assigning a value to the specified variable.

Otherwise, the value is assigned without expanding variables. In this case the value is computed while further using the variable. Meanwhile, the variable value and the value of all variables are expanded recursively until the very end.

There can be necessity of using both modes in tasks:

Expand variable value is on – when you have to fix the value in the moment of assigning it to the variable. For example: current time

Expand variable value is off – when you have to compose a complex expression of many variables and then you have to use only one variable in further steps. You also don’t need to turn on the expanding of variables if an assigned expression contains a static text and doesn’t contain other variables.

By default, the parameter is off.


note Related Topics

Set Variable

Remove Variable

Increment Variable

Delimited variable


Count array elements