I have dt1 with 1 row
dt2 with 10 rows
need to compare those 2 data tables & fetch 1 row from dt1 & remove in dt2 .After that copy that dt2 into another data table i.e dt3.
Please help
Read Range (dt1) → Read Range (dt2) → Join Data Table (Inner Join, based on common key) → Remove Data Row (from dt2) → Assign (Copy dt2 to dt3)
Please refer this solution
Hi,
You can use for loop and if to compare 2 dt
Then build new dt3 to assign
You can share your dt1 and dt2
Regards,
dt3=dt2.AsEnumerable().Except(dt1.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable
dt3 will have only uncommon rows.
Hope it helps.
Use the below linq expression
dt_UnCommonRows = dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable
Hope it helps!!
Hey @vnsatyasunil
Use join datatable activity
Please find the below xaml for your refernece.
Data Table.xaml (11.1 KB)
Output : DataTable.xlsx (6.8 KB)
I hope it helps!!
If you found the solution for your query. Please mark it as solution to close the thread.
Regards,
If you find the solution for your query Make mark it as solution which help to other forum members.
Happy Automation @vnsatyasunil !!
row is not deleting from datatable
not able to open document error coming while opening shared xaml file. Please share again
dt1 with 1 row
dt2 with 10 rows
then
dt3=dt2.AsEnumerable().Except(dt1.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable
if
dt2 with 1 row
dt1 with 10 rows
then
dt3=dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable
yes tried that way only in dt3 all 10 rows coming 9 should come by deleting 1 row right?
Forum.zip (15.0 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.