HI All,
I want to filter 2 datatable based on 2 column and find unique record from dt1 into seperate datatable.
column count may be different in this datatables but 2 column are fixed and want to apply filter on them.
Join DataTable - Left Join and react on the non founds
Or
LINQ as below
assign Activity:
dt3 =
(From d in dt1.AsEnumerable
Let c1 = d("Name").toString.Trim
Let c2 = d("Age").toString.Trim
Let arrC = new String(){c1,c2}
Let chk = dt2.asEnumerable.Any(Function (d2) {"Name","Age"}.Select(Function (x) d2(x).ToString.Trim).SequenceEqual(arrC))
Where Not chk
Select r =d).CopyToDataTable
Alternate (2 cols check without SequenceEqual Approach):
(From d In dt1.AsEnumerable
Let c1 = d("Name").toString.Trim
Let c2 = d("Age").toString.Trim
Let chk = dt2.asEnumerable.Any(Function (d2) d2("Name").ToString.Trim.Equals(c1) And d("Age").ToString.Trim.Equals(c2))
Where Not chk
Select r =d).CopyToDataTable
i have one doubt , how can we get last match record from datatable .
like lookup datatable activity gives first match record only. likewise i want last match record