Get value of a variable

I have an excel sheet with all the varables of my script. How do I get the value of these variables? I’ve created a datatable with these variable names but i can not get the value of the variable. With a For each i try to get the values with row(“Column0”) but then I get the name of the variable and not the value.
I’m completely new to UiPath so my excuses for asking stupid questions.
image

Kind regards
Jos

Hi Jos,
Where are the Value saved ?

If its in Excel, you can read it using Index eg row(1).toString

Hey Sishiramishra,
Thanks for your prompt reply.
With a read range I put the excel with the varaibles names in a Datatable. And I want to expand this DT with the variables value so it has to become Currency EUR. And now my result is Currency Currency.

Yes because its a single column with multiple row. To take a Column ref, instead of one Column, make it multiple Column and single Row

Sishiramishra,
Sorry, but what do you mean with single column? The data table or the excel?
The resulting data table has 2 columns.
As you see I’m completely new :wink:

image

Can you share Your Excel

Read Range will read entire sheet
When u are using For Each Row it will take first row as Column if in read range u check add headers
Then depending on that columns names u can extract row values say
Row("Currency).ToString
It will give for each iteration Currency column data

Prathamesh,

With the read range I only read column A and put it in a data table. On this DT I use the for each row and put the result in a new Data table with the variable name and value.

image001.jpg

image002.jpg

image007.jpg

image008.jpg

UiPath.xlsx (10.2 KB)

U can use read Range DT
Then use DT2=DT.DefaultView.ToTable(False,“ColumnName”) -----If u have only one column then dont do this

Then u can use For Each Row

Prathamesh,

I use For each row. The first column of the output DT is the name of the variable “Currency”. In the 2nd column I want the value of variable currency “EUR”

But my result is image.pngas you see currency, currency.

I use {row(“Variable”).tostring ,row(“Variable”)} in the Add Row activity.

image001.jpg

image002.jpg

image007.jpg

image006.jpg

So first u do like this
Use Assign DT2=DT.clone()
Add data column for DT2 and Give name of the column whatever u want
Then Use For Each Row
Use Add data row
in array add to DT2 as {Row(“Variable”).ToString,“EUR”}

If above is not what u want then give me the expected output

Prathamesh,

That isn’t what I want :wink:
I’ve exported all the variables that I use in my script. At the end of the script I want an overview of all the variables and their values. Therefore I use the exported list and i want to look up the value of the variable. Variable “Currency” has the value “EUR”. I don’t have to set it to “EUR”.

Kind regards
Jos

In your variable i.e. Currency stores the value?
Then u can add that variable in add data row
Like
{Row(“Currency”).tostring,Currency}

Prathamesh,

That is the problem: How do I get Currency in the add row activity? It is a string in the excel sheet.

Kind regards

Jos

Prathamesh,

That is the problem: How do I get Currency in the add row activity? It is a string in the excel sheet.

image001.jpg

image002.jpg

image007.jpg

image008.jpg

Please share your input and expected output in excel

Prathamesh,

See attachment.

De Input Datatable sheet contains all the variables from my script.

The Output sheet is what I want to achieve. The variable name and the value of this variable.

I have a For Each row that goes through the Input datatable and creates a new row in the Output Datatbale with an Add Datarow.

The ArrryRow contains: {row(“Variable”).tostring, row(“Variable”) } but the result is twice “Currency”.

The second row(“Variable”) should be the value of my variable.

image001.jpg

image002.jpg

image007.jpg

image008.jpg

UiPath.xlsx (11.1 KB)

Where are this values comes from
EUR
15
2000
BE-NL
3 months

Prathamesh,

These are variables that are created and calculated during the execution of the script itself.

image001.jpg

image002.jpg

image007.jpg

image008.jpg

Write those in place of second item in a array i.e. here Currency