Get corresponding row that matches with string

Hello,

I have a read range activity, and would like to use an assign that reads the corresponding row that matches with a string variable:

image

The output of the read range is the variable dtCorrespondingTab

My assign looks like this:
drCorrespondingRow = dtCorrespondingTab.Contains (strKeyArea)

How would I configure the above to get the corresponding row please?

I have posted a similar topic but that previous post had regex functions which I do not need

Thanks!

Assuming I have understood your request, you can get the index of a row that contains a value by using the Look Up Datatable activity, but you need to know the column name or index on which the string must be searched.

If you don’t know the column, then using a for each to iterate through the column of the datatable, you can use the same activity and Break when the value was found.

Lookup Datatable returns -1 as rowIndex when the value was not found.
More info about activity: Activities - Lookup Data Table (uipath.com)

Hi @E.T.S ,

We would still find difficult to suggest appropriately as the column information is missing (In which column to find the value).

Or does it not depend on a particular column and the value could be on any column ?

drCorrespondingRow = dtCorrespondingTab.AsEnumerable.Where(Function(x)x("ColumnName").ToString.Equals(strKeyArea)).FirstOrDefault

The above expression is used to be when you know the Column to check. Also, it would return empty if there is no match found.

Read the whole sheet then use Filter Data Table to keep the row you want.

Hi @E.T.S ,

You can use the Filter Data Table activity after reading the table, in order to get a filtered table which contains matched string