Match Rows in Column1 from DT2 to Any Rows in Column1 Of DT1 and write it to DT3

i have datatables. DT1 has 10 thousand rows and DT2 has 8 thousand rows. They have a common column name ACCOUNT_NO. i want to match rows in Column1 from DT1 to any rows in Column1 from DT2 and write it to another DT. how can i achieve this?

Hi @Caithlyn_Saturos

Welcome to forum

For this for in this way

  1. use read range activitiy to read the exc file and store in dt1

  2. use another read range activitiy to read another file and store in dt2 variable

  3. using join datatable activitiy and provide input as dt1 , dt2 with join type as inner and condition as column 1 = column1, and its output datatable create a variable called dt3

  4. use write range to write the dt3 to excel file

Hope it helps

Mark it as solution if you got it

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

@Caithlyn_Saturos

Welcome to forums

You can do this by using LinQ functions as you have huge data

Assign a new DT3 datatable variable and write as below

(From d1 In DT1.AsEnumerable
Join d2 In DT2.AsEnumerable
On d2(YourColumnNameOrIndex).ToString() Equals d1(“YourColumnNameOrIndex”).ToString() 
Select d1).CopyToDataTable 

Mark as solution if this helps

Thanks

2 Likes