A variable previxed with #

Discuss RoboTask here
Post Reply
OldGeek
Posts: 49
Joined: Thu Jun 01, 2023 2:50 pm
Location: Upstate NY

A variable previxed with #

Post by OldGeek »

I recently downloaded a task from the forums. It used a variable {#Text}. Is this an array

Variable.jpg
Variable.jpg (44.4 KiB) Viewed 165 times
Windows 11 Pro, RoboTask v10.5
Oleg
Site Admin
Posts: 3256
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: A variable previxed with #

Post by Oleg »

What is the task? Please give me a link so I can explain the algorithm in more detail.
About # read here please: https://robotask.com/help/index.html?ru ... iables.htm The depth of expanding variable.

If you use {Text}, the variable is expanded to its full depth. That is, if the Text variable contains other variables in the text, they will also be expanded, and so on recursively to the very end.

If you use {#Text}, only the content of the Text variable will be extracted without attempting to expand variables in the content of the variable.

Sometimes it can be useful.
Oleg Yershov
OldGeek
Posts: 49
Joined: Thu Jun 01, 2023 2:50 pm
Location: Upstate NY

Re: A variable previxed with #

Post by OldGeek »

The task came pre-installed in the "Complex" folder, it's name was "Retrieve task parameters to CSV" or "[DEMO] Retrieve task parameters to CSV"
It reads the task names, etc using VBScript into a variable Text. The next statement was Str Trim with the source string {#Text} and the Assigned Results was Text (no curly braces)
RoboTask Code.jpg
RoboTask Code.jpg (80.9 KiB) Viewed 145 times
Windows 11 Pro, RoboTask v10.5
Oleg
Site Admin
Posts: 3256
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: A variable previxed with #

Post by Oleg »

I have (for example) many tasks with names that contain strings such as {Date}, {DateTime}, {TaskFolder}, and other variables. I need the original task names to be preserved in the list, i.e., the variables should remain unexpanded.
So I use the explession {#Text}
Oleg Yershov
Post Reply