How to read value of individual cells from datatable

How do I read an individual value from a row and column in a datatable ?

I know I can do for each row and then get item … that’s too cumbersome

I need to simply say x = datatable (row, col)

1 Like

Hey @bdavidov

You can try this way:

"Datatablename".Rows(“rownumber”).Item(“columnName/columnNumber”)

Regards…!!
Aksh

24 Likes

Perfect … Thanks

Thanks … How do I get the number of rows and columns in a datatable?

DATABLE ROWS COUNT = Datablename.Rows.Count

Datable coulmn count = Datablename.Columns.Count

Regards…!!
Aksh

1 Like

Hi,
I am new to UIPath. I am trying to use the expression below as you suggested for getting 2nd row and 0th column. But it pops up an error saying object to string conversion is not possible. Can you tell me what wrong I am doing?
ExtractDataTable.Rows(2).Item(0)

Thanks

1 Like

Hi @shivnagsudhakar,

Convert.ToString(ExtractDataTable.Rows(RowNumber)("ColumnName"))
or
Convert.ToString(ExtractDataTable.Rows(RowNumber)(ColumnIndex))

If you are using For each row activity
To get some value from the data row.
Convert.ToString(row("ColumnName"))
Or
Convert.ToString(row(ColumnIndex))

ColumnIndex , RowNumber->integer value
ColumnName->String value

Regards,
Arivu

3 Likes

Hey @shivnagsudhakar

I just wanna know where you are using this expression ? in a writeline to write it on console for debugging purpose?

or assigning into a variable? - if so what datatype of variable ?

Regards…!!
Aksh

I am new to Uipath and I have a situation like I have a table of data (only one column). I need to check for a particular string value in the rows in the table. I am using “for each item”. Inside that how do I do a comparison with a string for each item in the row of the table.
I tried “.contains” - it gave me an error “Message box : Table doesn’t have a primary key.”

row.equals inside a “forEach Data table” work?

Use Get Row Item activity store the value of the column in a variable the you can use your condition to work upon. See attached sample

Main.xaml (8.7 KB)

Thank you so much for the reply. My intention is to find a particular row and click on that (it is a hyperlink). I tried with 'find children" but it is giving me compile error after i indicate the first row in the screen in “Find Children” activity
image

OR

image

Hello there!
I would like to do the same!
Did you succed? If yes, how?

1 Like

Try Datatable(RowNum)(ColNum)

1 Like

are we able to use Datatable(StringVariable) ?

Hi,

I tried this but did not work, I’m getting a blank value

Hi,

I tried this in an assing but did not work