Compare two tables and keep not matching rows

I have two data tables and I need to see which items are not matching in these two tables.

How should I do it?


Can you elaborate?

For example, the following topic might help you.


1 Like

Use a assign activity and try this out to Get Not Matched Records

Out_NonMatched_Data = In_DataTable1.AsEnumerable().Where(function(row) Not In_DataTable2.AsEnumerable().Select(function(r) r.Field(Of Int32)(In_DT2_ColName_To_Match.ToString)).Any(function(x) x = row.Field(Of Int32)(In_DT1_ColName_To_Match.ToString))).CopyToDataTable()`


@Yoichi I have tried the link you have provided and grabbed the example. I have applied it to my project but I am getting the “The source contains no DataRows” error. I have checked my table and they both contain values.

:ambulance: :sos: [FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum

@Yoichi I have added a step to count whether the two tables are empty or not:

dta.AsEnumerable.Except(dtB.AsEnumerable,DataRowComparer.Default).Count = 0 AND dtB.AsEnumerable.Except(dtA.AsEnumerable,DataRowComparer.Default).Count = 0

That solved the issue!

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