How to compare two columns in two different DT's and write in a DT (Not by using Look up DT and Left Joint )

Hi There,
Hope doing well !


Please find the Input (Table1 & Table2)

With the input I need Output by using Linq

Thank you in advance
Thanks in Advance ,
@ppr
@Yoichi
@ushu
@vishal.kp
@supermanPunch
@Anil_G

Happy Automation
regards,
@kmaddikatla

Why do you insist on using Linq? A join is the correct way to do this. It’s basic database stuff.

Thank you for quick response @postwick

i’m trying to explore using Linq

Thank you
Happy Automation

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

Prepare the target datatable e.g. with a build Datatable - dtResult

Assign Activity
dtResult =

(From d1 In dt1.AsEnumerable
Group Join d2 In dt2.AsEnumerable
On d1("Name").toString.ToUpper.Trim Equals d2("Name").toString.ToUpper.Trim Into gj = Group
From j In gj.DefaultIfEmpty()
Let ra2 = If(isNothing(j), new Object(){nothing, nothing},j.ItemArray.Skip(1).toArray)
Let ra = d1.ItemArray.Concat(ra2).toArray
Select r = dtResult.Rows.Add(ra)).CopyToDataTable

we can dynamize it more, so take it as a starter sample

Never miss out to explore / compare with other options e.g. Join DataTable and also explore hybride options like Join DataTable + LINQ Filtering on the Join Result

@kmaddikatla Hi,

Please refer below link which refers to comparing two tables based on common values

Cheers,