How to get row from another DataTable using linq?

Hello !
I have two datatable, I want to search name from DT1 in DT2 and if name exitsts i want to get row from column “Emails” in DT.

How can i do that ?

Hi @prabin_chand1

You can try with LookupData Table activity

https://docs.uipath.com/activities/other/latest/user-guide/lookup-data-table

Regards
Gokul

Hey @prabin_chand1 ,
I believe you can do this by inner join method
Try this,

(
From a In DT1
Join b In DT2
On a("Name").ToString Equals b("Name").ToString
Select OutputDT.Rows.Add({a("Name"),b("Email")})
).CopyToDataTable

Regards,

2 Likes

I cannot use Equals as Name are different in length . Therefore i need to use Contains method.

How can i use contains method in above code ?

Hey @prabin_chand1 ,

Have a look at this thread.

Thanks,
Sanjit

To search for a name in DT1 and get the corresponding row from column “Emails” in DT2 in UiPath, you can follow these steps:

  1. Use the “Lookup Data Table” activity to search for the name in DT2.
  2. Configure the “Lookup Data Table” activity by specifying the input parameters:a. In the “Input” field, select DT2 as the DataTable you want to search.b. In the “Lookup value” field, specify the name you want to search for from DT1.