Hello Everyone,
DT1
DT2
I want to get the mismatch rows of “NAME” Column AND if no Mismatch i want to get empty Datatable
Hello Everyone,
DT1
DT2
I want to get the mismatch rows of “NAME” Column AND if no Mismatch i want to get empty Datatable
use the below syntax
DT.AsEnumerable.Where(Function(x,i) not x(“Name”).ToString.Equals(DT1(i)(“Name”))).CopyToDataTable
cheers!
Try this LinQ
DTMismatch = (From row1 In DT1.AsEnumerable()
Join row2 In DT2.AsEnumerable() On row1("NAME").ToString() Equals row2("NAME").ToString() Into matchedRows
Where Not matchedRows.Any()
Select row1).CopyToDataTable()
Try this:
result = (From row1 In DT1.AsEnumerable()
Join row2 In DT2.AsEnumerable() On row1.Field(Of Integer)("Name") Equals row2.Field(Of Integer)("Name") Into Group
From g In Group.DefaultIfEmpty()
Where g Is Nothing OrElse Not row1.ItemArray.SequenceEqual(g.ItemArray)
Select row1).CopyToDataTable()
result is of DataType System.Data.DataTable
Hope it helps!!
Hi ,
you can try like this.
dt = Build Datatable
for each row in DT1
{
If( not dt2.AsEnumerable().Any(function(x) x(“Name”).ToString = Currentrow(“Name”).ToString))
{
Add Datarow(Currentrow.ItemArray) to dt
}
}
so many errors
this errors is showing in the assign activity
Try this:
result = (From row1 In DT1.AsEnumerable()
Group Join row2 In DT2.AsEnumerable() On row1.Field(Of Integer)("Name") Equals row2.Field(Of Integer)("Name") Into Group
From g In Group.DefaultIfEmpty()
Where g Is Nothing OrElse Not row1.ItemArray.SequenceEqual(g.ItemArray)
Select row1).CopyToDataTable()
Regards
output is same as input
dt1.AsEnumerable.Where(Function(a) not dt2.AsEnumerable.Any(function(b) b(0).ToString.Equals(a(0).ToString))).ToArray
try this output is array of datarow
use if activity
i have already provided the sample data it is same nothing changed and i want the Not Matched Row Or Empty Table If there is no Not Matched Rows
Try this:
DT1.AsEnumerable().Where(function(row) Not DT2.AsEnumerable().Select(function(r) r("Name").ToString).Any(function(x) x = row("Name").ToString)).CopyToDataTable()
DT1
DT2
Output Result
Hope it helps!!
Regards
this error is showing if there are no Mis matched Column
Check out this zip file
BlankProcess7.zip (131.8 KB)
This will print an empty data table if DT1 and DT2 have matching rows.
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.