Filter data table?

i have two data tables on is new datatable another is old datatable i need to filter new datatable based on old table particular values if new row availaabe writer anoter table there is any rows not availabe show message box.
s.no name unit
101 rk 1000
102 dt 344
103 jk 6523
105 ad 7900
108 hg 549
106 kl 800
s.no name unit
101 rk 1000
102 dt 344
103 jk 6523
105 ad 7900

Hi @domsmgtmeet22

FilteredDT = (From newRow In NewDT.AsEnumerable()
              Where Not (From oldRow In OldDT.AsEnumerable()
                         Select oldRow.Field(Of Int32)("s.no"))
                         .Contains(newRow.Field(Of Int32)("s.no"))
              Select newRow).CopyToDataTable()

Regards,

@domsmgtmeet22

Use this expression:

filteredRows = newDataTable.AsEnumerable().Where(Function(row) oldDataTable.AsEnumerable().Any(Function(oldRow) oldRow.Field(Of Integer)(“s.no”) = row.Field(Of Integer)(“s.no”))).CopyToDataTable()

how to write in excel this values if there is no rows show message box

no data means??

You after the linq query if there is no data found??

i extract every day particular table day to day update there table so some not updata the table. it means no data

@domsmgtmeet22

arrDr = (From newRow In NewDT.AsEnumerable()
                     Where Not (From oldRow In OldDT.AsEnumerable()
                                Select oldRow.Field(Of Int32)("s.no"))
                                .Contains(newRow.Field(Of Int32)("s.no"))
                     Select newRow).ToArray()

Regards,

Try this:

missingRows = oldDataTable.AsEnumerable().
Where(Function(oldRow) Not newDataTable.AsEnumerable().
Any(Function(newRow) newRow.Field(Of Integer)(“s.no”) = oldRow.Field(Of Integer)(“s.no”))).
CopyToDataTable()

after that use write range activity and pass the missingrows in datatable

its not work share your work flow

@domsmgtmeet22

Sequence16.xaml (13.5 KB)

Regards,

@domsmgtmeet22

Use the below query

(From newRow In NewDT.AsEnumerable()
 Where Not (From oldRow In OldDT.AsEnumerable()
            Select oldRow.Field(Of String)("s.no"))
            .Contains(newRow.Field(Of String)("s.no"))
 Select newRow).ToArray()