Join Two DataTables

datatable
#21

hi @krisleunis,
You can compare two dataTables and get extras or I can say unmatched records by using this:

dt3 = dt2.AsEnumerable().Where(function(f) Not dt1.AsEnumerable().Select(function(i) i.Field(Of Int32)(“ID”).ToString).Any(function(i2) i2 = f.Field(Of Int32)(“ID”).ToString)).CopyToDataTable()

e.g.
dt1 --> has 3 records,
dt2 --> has 4 records (1 extra).

here’s my workflow:
Main.xaml (9.6 KB)

I hope this will help you. :slight_smile:

0 Likes

#22

Hi @samir,

Many thanks for your help.
Your workflow indeed works for the example I provided.
However, it does not work in the scenario where both datatables contain unique records. :cry:

Please find the example below:

dtInputOne
ID,Value
1,“John”
6,"Albert"
2,“Ringo”
3,“Paul”
4,“George”

dtInputTwo
ID,Value
1,“John”
2,“Ringo”
3,“Paul”
4,“George”
5,“Yoko”

Based on these, how can I obtain?

dtOutput
ID,Value
6,"Albert"
5,“Yoko”

P.S. This is a feature I expected the Join Data Tables activity to have the JoinType “Outer”

0 Likes