To compare the data of two table using linq query

I try to compare the two table by using linq query , here we check the dt1 contain the value of substring dt2 of two where dt1 and dt3 are datatable
this is the code:-
(
From a In dt1.AsEnumerable
From b In dt3.AsEnumerable
Let b = If (a(“Display Name”).ToString).Contains(b(“two_word”).ToString),Let a(“Status”) =“Match Found”,Let a(“Status”)=“Match Not Found”
Select a(“status”)
).CopyToDataTable

but i am getting error
image

Hi @Shishir_Kumar ,
You can use a multiple assign where you create a temporary data table, then you can use my code and put the columns according to the data table named dt1.

Example:
image

Code:
(From x In DT_Aux
Let status = If ( dt3.AsEnumerable.Where(Function(y) x.item(“Display Name”).tostring.contains(y.item(“two_word”).tostring)).ToArray.COUNT>0,
“Match Found”,
“Match Not Found”)
Select dt1.Rows.Add(New Object(){x.item(0).tostring, x.item(1).tostring,x.item(2).tostring, status.ToString})).copytodatatable

Have a great day!
Please let me know if you need anything else.

1 Like

Thank you so much , please suggest me from where I learn LINQ query.

@Shishir_Kumar Have a look at this

https://forum.uipath.com/search?q=linq

Regards
Sudharsan

Hi @Shishir_Kumar,

You can learn LINQ Query in the link below:

Have a great day!
Please let me know if you need anything else.

1 Like