Luffy
(Luffy)
July 18, 2023, 1:55pm
1
dt3.AsEnumerable.where(Function(x)dt_TR.AsEnumerable.Where(Function(y)x(“col1”).ToString.Contains(y(“Col2”).ToString)).Count>0).CopyToDataTable
i have this code and i want to match all values of Col1 and Col2 values.
Col1 column value is like abc and Col2 column value like le_abc
please correct this code.
@Luffy
Try this one
dt3.AsEnumerable().Where(Function(x) dt_TR.AsEnumerable().Any(Function(y) y("Col2").ToString().Contains(x("Col1").ToString()))).CopyToDataTable()
1 Like
Luffy
(Luffy)
July 18, 2023, 2:04pm
4
i have already implemented this solution but not getting the correct output.
only 1 matched row will generate.
@Luffy
Try this with to upper
dt3.AsEnumerable().Where(Function(x) dt_TR.AsEnumerable().Any(Function(y) y("Col2").ToString().ToUpper.Contains(x("Col1").ToString().ToUpper))).CopyToDataTable()
supriya117
(Supriya Allada)
July 18, 2023, 2:11pm
6
Hi @Luffy
Try this:
dt3.AsEnumerable.Where(Function(x) dt_TR.AsEnumerable.Any(Function(y) x("Col1").ToString.Contains("le_" + y("Col2").ToString))).CopyToDataTable()
lrtetala
(Lakshman Reddy)
July 18, 2023, 2:13pm
7
Hi @Luffy
Try this
dt3.AsEnumerable().Where(Function(x) dt_TR.AsEnumerable().Any(Function(y) y("Col2").ToString().Contains(x("Col1").ToString()))).CopyToDataTable()
I hope it works!!
Luffy
(Luffy)
July 18, 2023, 2:20pm
10
not working , only 1 row is coming
@Luffy How many rows should come after matching. If its giving one row it means that something different in data
lrtetala
(Lakshman Reddy)
July 18, 2023, 2:31pm
12
@Luffy
Try this once
dt3.AsEnumerable().Where(Function(x) dt_TR.AsEnumerable().Any(Function(y) y.Field(Of String)(“Col2”).Contains(x.Field(Of String)(“Col1”)))).CopyToDataTable()
Luffy
(Luffy)
July 18, 2023, 2:38pm
13
output should be 5 rows and here we are just matching one column don’t know what i am doing wrong
J0ska
July 18, 2023, 2:42pm
14
Better paste here your sample data and the expected result.
Cheers
mkankatala
(Mahesh Kankatala)
July 18, 2023, 2:44pm
15
Hi @Luffy
Could you please share what you are linq querey and workflow. Then we will get better understanding about it.
Hope it helps!!
supriya117
(Supriya Allada)
July 18, 2023, 2:45pm
16
@Luffy
Use this :
dt3.AsEnumerable.Where(Function(x) dt_TR.AsEnumerable.Any(Function(y) x("Col1").ToString.Trim().Contains(y("Col2").ToString.Trim(), StringComparison.OrdinalIgnoreCase))).CopyToDataTable()
J0ska
July 18, 2023, 3:10pm
17
or in LINQ form
dt = (From a In dt1.AsEnumerable
Where dt2.AsEnumerable.Any(Function (b) CStr(b(“col1”)).Contains(CStr(a(“col1”))))
Select r=a).CopyToDataTable
system
(system)
Closed
July 21, 2023, 3:11pm
18
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.