Expand variable value

Discuss RoboTask here
Post Reply
gdrencevic
Posts: 1
Joined: Fri Apr 04, 2008 7:24 am

Expand variable value

Post by gdrencevic »

Hello,
What does "Expand variable value" means ?
Thank you for your explanation.
 
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Expand variable value

Post by Oleg »

I think you mean the "Expand variable value" parameter in "Set variable" or "Add variable" actions.
If you turn on this parameter, then RoboTask expands the expression before assigning to another variable. Otherwise it will assign the expression "as is".

For example:
02:00:00 PM
We assign to variable Var1 the value '{Time}' (without expanding) in order to save the moment of beginning
Next we do something during 20 sec
At last show message 'The process has been begun at {Var1} and ended at {Time}'

We'll get the message 'The process was begun at 02:00:20 PM and ended at 02:00:20 PM'

It is incorrect, because we need to save real time in variable (not a variable name) and we must expand the value (i.e. replace the variables in expression with their values)
If we turn On expanding of value we will get correct message
'The process was begun at 02:00:00 PM and ended at 02:00:20 PM'

Another example:
Suppose we need to count lines in each text file and save the results as a text in variable Result
after counting of lines of each text we have to assign variable Result with text
{Result}{Eol}File {FileName} contains {CNT} lines

You see that the value contains the name of variable recursively ({Result}). In this case we must expand the value before assigning, otherwise we will not get the correct result at all.
Post Reply