Hello. I have two data tables with some columns. Most of the row values are same in both data tables. But some values are there in 2nd data table which are not matching with 1st table
Employee details1.xlsx (8.3 KB)
Employee details2.xlsx (8.4 KB)
. I want to compare this two data tables and delete mismatching row values from 2nd table. I have attached example of data tables:
Hello @Vanitha_VS ,
Refer to this video, you will get some idea.
HI,
Hope the following sample helps you.
arrDr = dt2.AsEnumerable.Except(dt1.AsEnumerable,DataRowComparer.Default).ToArray
Sample20221128-3.zip (14.5 KB)
Regards,
Hi @Vanitha_VS
Try with this
dt1.AsEnumerable.where(Function(r1) dt2.AsEnumerable.All(Function(r2)( (r2(“Name”) isnot r1(“Name”) )And (r2(“Salary”) isnot r1(“Salary”)) and (r2(“Email”) isnot r1(“Email”))))).ToArray.CopyToDataTable
I need to delete data (In 2nd data table) which are not there in 1st data table. i no need to write data in one excel. in same excel that is 2nd excel, i need to remove not matching data.
@Vanitha_VS Try this Custom Activity
Have you checked this workflow? @Vanitha_VS
Hi @Vanitha_VS
You can try like this
dtOutput=dt2.AsEnumerable().Where(Function(x) dt1.AsEnumerable().Any(Function(x) x(“ID”).ToString=row(“ID”).ToString)).CopyToDatatable
Here id is the column in dt1 and dt2 which is being compared and dt1 is first datatable and dt2 is second datatable
Dtoutput being the output required
Cheers
Chhers
Thanks you Gokul, it is working fine for me
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

