How to get matching entries among two datatable's

Hi @MasterOfLogic

You just need two assign activities to achieve your output by using the LINQ query as below.

dt1Output=dt1.AsEnumerable().Where(Function(row) dt2.AsEnumerable().Any(Function(x) x(“NAME”).ToString=row(“NAME”).ToString)).CopyToDatatable;

dt2Output=dt1.AsEnumerable().Where(Function(row) NOT dt2.AsEnumerable().Any(Function(x) x(“NAME”).ToString=row(“NAME”).ToString)).CopyToDatatable;

  • The dt1Output is like normal join query where dt1 matches with the NAME column of dt2

  • The dt2Output fetches data from dt1 which are not in dt2 based on NAME column

Refer the screen shot below for the workflow
image

Output screenshot:
image

You can also use SQL queries in execute query activity to achieve the output.

SQL and LINQ are powerful hence faster and uses fewer activities giving the best performance.

Note: If by chance you get “AsEnumerable is not a member of datatable” issue then this link will help you to fix: AsEnumerable is not a member of 'System.Data.Datatable' - #2 by loginerror

Please find the attached zip file to run the XAML file.
matchind_datatable.zip (8.3 KB)

4 Likes