Value of type 'Integer' cannot be converted to 'System.Data.DataRow'

Hi Developers

I’m getting the error stated in the title (refer screenshot). My objective is to get the index number of each row in the data table and use that as a variable (Rowstart). This variable is then in the selector and is used to click through the same number of lines in SAP.

I just can’t seem to get around this error and have already searched everywhere for some ideas but haven’t found any.

Can anyone please help?

Thanks.

Sergio

The index of is taking an invalid argument. It will work if you put it like that:
Range.Rows.IndexOf(row).Tostring

The IndexOf takes an entire row of the data table as an argument.

Thanks Loginerror. That solved the problem. But now I have a new one.

Range.Rows.IndexOf(row).Tostring is reading the first value as 0 but I need the fist value to be 2 as the selector in SAP for the first row I need to click is 2.

I’m trying but not getting there. Tried doing an assign using CInt(Rowstart)+2 but it tells me that cannot assign from type ‘System.Int32’ to type ‘System.String’ in Assign activity ‘Assign’

HI @Sergio_Goncalves,

Try below code
row(0).ToString()

Simply add 2 within the assign activity, like this:
(Range.Rows.IndexOf(row)+2).ToString

So Simple. Thanks Loginerror. I was missing the parenthesis. Solved.

Hello everyone!

I an new using uipath. I am trying for each rows from a datatable to get the value but I have an issue with the Row in “get row item” activity.

I create a variable rowNumber to put the index from “for each row” the output is an Integer so when I want to use it in “get row item” I get: Value of type ‘Integer’ cannot be converted to ‘System.Data.DataRow’. error because the second activity needs an DataRow not a Integer.
Any suggestions?