Set Variable

Top  Previous  Next

 

Defines the value of a variable when you run a task.

 

clip0049

 

Variable Name

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

 

Variable Value

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

 

Expand Variable Value

This parameter is necessary for RoboTask to expand all macros with variables before assigning values.

 

For example:

Suppose, you assign the Now is {TIME} value to a variable.

If the Expand Variable Value parameter is enabled, RoboTask will expand the macro with the variable (i.e. insert the current time) and assign the following string to the variable: Now is 11:38:15.

Otherwise RoboTask will assign the string as it is. In this case, the macro will be expanded only when the variable is called.

 

Another example:

Suppose you assign a string to the MyStr variable. Now we need to generate the following string:

Received string is: - and then comes the content of the variable.

And then we need to assign the resulting value to MyStr again.

It is really easy to do it if you enable the Expand Variable Value parameter:
Type the following in the Variable Name field: MyStr

Type the following in the Variable Value field: Received string is: {MyVar}

And make sure you enable the Expand Variable Value parameter. Otherwise it will not work, because the variable recursively refers to itself in this case and RoboTask just cannot calculate the value when the MyVar variable is called.

 

note Related Topics

Create Variable

Remove Variable

Increment Variable

Delimited variable