Hello community,
i want to keep rows which i will be providing through Datatable but this table contains some part of rows
For Example:
dt1:
dt2:
Output:
Note:dt1 will have dynamic rows, i want to keep rows of dt2 which contains the dt1 rows values in Dt2
lrtetala
(Lakshman Reddy)
June 11, 2024, 1:43pm
2
Hi @Prateek_Pathak
Try this
dt2.AsEnumerable().Where(Function(row) dt1.AsEnumerable().Any(Function(r) row("Brand_ID").ToString.Contains(r("Brand_ID").ToString))).CopyToDataTable()
Input:
DT1
DT2
Output:
Regards,
ppr
(Peter Preuss)
June 11, 2024, 1:47pm
3
One of many options
Assign Activity
dtResult =
(From d in dt2.AsEnumerable
Let mv = d("Brand_ID").toString
Where dt1.AsEnumerable.Any(Function (x) mv.Contains(x("Brand_ID").toString.Trim) )
Select r=d).CopyToDataTable
And also
This FirstAid Tutorial will describe how a the source contains no DataRows EXCEPTION can be handled.
Introduction
Let’s have a look at the following filter data table scenario:
Name
CCode
Tom
US
Charlotte
FR
Seema
IN
Jean
FR
Assignment:
Filter all rows on a particular Country Code like FR, UK, ES, UK…
Ensure that all CCode data column values are trimmed
Ensure that the Filter check is case insensitive
we can implement it e.g. with the help of a LINQ statement:
dtData.AsE…
thanks for the solution its woking fine.
system
(system)
Closed
June 14, 2024, 1:56pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.