I want to join two different data tables with matching the columns UIDa(dt_Driver) from UIDb(dt_Track).
For unmatched rows, I want to put #N/A on columns from dt_Track(excluding UIDb). I’m not really good on making context but I hope with this input and output it will explain the rest.
This is the process and linq that I tried but it seems it does not return the values from dt_Track Test.xaml (13.7 KB)
(
From part In dt_Driver
Group Join trans In dt_Track
On trans("UIDb").ToString Equals part("UIDa").ToString.Replace("'","") Into grp = Group
From g In grp.DefaultIfEmpty
Let UID = g("UIDb").ToString
Let Name = part("Name").ToString
Let Car = part("Car").ToString
Let Track = If(IsNothing(g), "#N/A",part("Track").ToSTring)
Let Country = If(IsNothing(g), "#N/A",part("Country").ToString)
Let Remarks = If(IsNothing(g), "#N/A", "WINNER")
Select dt_Consolidated.Rows.Add(UID,Name,Car,Track,Country,Remarks)
).CopyToDatatable
We tried using Join Activity of UiPath at some other time, the problem with Join activity is that when using it on more than one million transactions it causes Job Stop on the execution because of UiPath memory capacity. This is the reason why we are trying to implement in LINQ to avoid the stopping of the execution.
It seems that I already got the solution but there is a ghost row where I don’t where it come from.
(
From part In dt_Driver
Group Join trans In dt_Track
On part("UIDa").ToString Equals trans("UIDb").ToString Into grp = Group
From g In grp.DefaultIfEmpty
Select dt_Consolidated.Rows.Add({If(IsNothing(g), "#N/A",g("UIDb")),part("Name"),part("Car"),If(IsNothing(g), "#N/A",g("Track")),If(IsNothing(g), "#N/A",g("Country")),If(IsNothing(g), "#N/A", "WINNER")})
).CopyToDatatable
Thank you sir @ashwin.ashok , I logged the number of rows of each input data tables, it seems that I miss out a blank row on the first data table after the header.