Read a dataRow from a DataTable based on row Index

Is it possible to Read a dataRow from a DataTable based on row Index.

Please help me.

Hello @maria.josephina Yes it is possible to read. You can go through this to get better understanding

https://activities.uipath.com/docs/get-row-item

Also, you can get Row index from datatable inside Loop like below :

foreach(DataRow row in yourdatatable.Rows)
{
Int value_row_index =yourdatatable.Rows.Indexof(row)
//Writeline value_row_index.ToString()
}

1 Like

If my DataTable ‘dataTable’ consists of 10 elements(data) and if I want to retrieve 1st element, What query can I use.
something like : dataTable.Rows(0)

1 Like

Hi - can you try using the following expression : datatable.row.index(value)

1 Like

DataTable.Rows(0)(0).ToString

DataTableVariable.Rows(RowIndex)(ColIndex).ToString

This would give you first element which is at First Row First Column

Thanks,
Prankur

6 Likes

yes you can: DataTableName.Rows(row_Index).item(Col-Index/col_Name).ToString

2 Likes

Thankyou @Divyashreem and @PrankurJoshi

1 Like

Mark it as solution if it worked

Thanks,
Prankur

Thank you @PrankurJoshi

1 Like

Hi Pankur how can obtain a range of values in a datatable… Example i have only a column and I need the row number 0 to the row number 14.

image