Compare two datatables and find row index of matching data

I have a scenario where I need to find row matches in two datatables where a certain value is found in both rows. Then I need to extract the row index of each match to use as an anchor for a selector.

Would it be as easy as using the DataTable.Rows.Contains method to check if the table already contains a row with same data? Or is there a better way with a for each row in datatable activity.


Hi @b.forbes ,

I believe we could use Join Datatables Activity to get the Matched Data between the two Datatables. The Join type should be Inner Join. We could then iterate through this Output of Join Datatables Activity using a For Each Row Activity and create an index and use it for the Anchor.

The above suggestion is provided based on the input statement that was given, if it does not fully satisfy your requirements, maybe you could provide more descriptive details of the process.

Let us know your thoughts on the suggestion.

1 Like

Hi @b.forbes

You can also look at:
Get column index and row index for specific values - Help - UiPath Community Forum

Thanks & Regards
Loveleet Saini

1 Like

Hello @b.forbes
You can get the Current row index by getting output from index properties as an Integer variable type. Based on current row, we can get the index in loop.


I ended up using a for each loop to add specific data from a certain column in the first datatable to a collection (list).

Then I used a for each loop to iterate through the list and use the lookup datatable activity to lookup the second datatable, and where there is a match I assigned the row index to a variable.

This gives me the correct row index for the matched list value, which I can use as the input for a selector.

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