UiPath Variables - Get variable's value from a string

Hi all!

I’m having an issue when trying to replace some variables into a string.

The data to be replaced for is into an Excel workbook.

Now, some of the contents on the first column need to be replaced just for the value in the sencond column. No problem with that. The issue appears when I’m trying to use the content on the second column as name of a variable.

Is there a way in VB.NET to get a variable’s value using the variable’s name as string?

I would need something like:

GetValue(“variableName”)

Or else, is there a way of putting all the variables in UiPath in to a dictionary?

I look forward to your help!!

Regards,

If you use the RE Framework to create your process it comes with a config file which does just that.

You enter a string value as the variable title and the content is picked up as an object. All variables in the config file are stored in a dictionary (string, object) variable for use throughout your process

https://forum.uipath.com/t/how-to-create-config-file-and-how-to-use-it-in-uipath/33619

Sure, you can use a dictionary, like above poster mentioned. But, I’m not sure that’s what you need, since you need to use the value as the variable.

One method I use a lot is String.Format().
For example, instead of str_NotAttachement use {0}
Then, in your code use String.Format(dict("mvar2").ToString, str_NotAttachement)
—that will place the variable str_NotAttachement into the value where you have {0}. You can have as many parameters too so use {0},{1}, and so on

Hi,

Where you able to get the value of your variable str_NotAttachment?
And if you did can you tell me how because I’m stuck with the same problem.

Kind regards

Jos