Create new table by comparing two other tables: New table contains items from table1 that were not found in table2

Oh so it represents the specific enumerable it is on. Like row in a for each…

@Asanka
(From d1 In DTFull.AsEnumerable ← looping over DTFull
Join d2 In DTPart.AsEnumerable ← looping over DTPart
On d1(0).ToString Equals d2(0).ToString ← Checks if both rows are matching the join clause
Select d2).CopyToDatatable ← selects from the matches the d2 row
all d2 are copied to a datatable

dtfull.AsEnumerable().Except(dtfinal.AsEnumerable(),DataRowComparer.Default).CopyToDataTable()
is working via so called set operations

all rows from dtfull are taken as long these rows are not present in dtfinal, also called the minus operation

1 Like

Okay seriously…that is so cool. I really appreciate you taking the time to explain this stuff to me @ppr

@Asanka
Statement from @Palaniyappan and that one from my referenced XAML (see link from my post) are close and similar in the meaning. What can happen is that the except statement is returning no rows, e.g there are no uncommon rows. then CopytoDataTable is throwing an exeception. Have a look on the post/on my xaml on how to save up this part with checking the row count and only using copytodatatable if rows are returned.

Happy automation

1 Like

Hey,

I took a look and added in what you said. Thanks again!

Big props to @ppr and @Palaniyappan

1 Like

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