Want to find row index based of cell value from a Datatable

Hi ,

image

suppose we have this above datatable and we know that their is a value in column Column 4 i.e. r so want to get the index of that particular row.
in current example the index value based on Column 4 value r is 2
please help

Please refer below thread

https://forum.uipath.com/t/plz-solovemy-issues/540953

It has answers related to same requirement

Regards

Hi @ravig1206 ,

You can you lookup Range activity inside excel application scope.

output = D4

You can get index number

OutIndex = Cint(System.Text.RegularExpressions.Match(output,“[0-9]+(.[0-9]+)”).ToString)-2

Note: If you targeting specific column, Mention Range in Lookup range activity “D” . So that can get range of specific column value

Thanks!

Hi @ravig1206 ,

Maybe you could check with the below Expression :

DT.AsEnumerable.Select(Function(x,i)if(x.ItemArray.Any(Function(y)y.ToString.Equals("r")),i,-1)).SkipWhile(Function(x)x=-1).First

Let us know if you are not able to implement the above approach.

Hi @ravig1206

For your Scenario:

If you want to Check specific Column name value contains your expected Value so that u need the row index ofthe Current row.

U can use below Activity for simple way.

Note: if you want all Row index values for the Entire column validation u can proceed and add the collection value as array/list.

Thanks
VP

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.