Hi all,
I’m new to LINQ query and I received a solution previously based on my query from this post.
https://forum.uipath.com/t/compare-two-excels-and-update/284730/4?u=jenkim
So I encountered an error whenever there’s no data to be copied to datatable. So I change it as below to cater that error but seems like it doesn’t work with those variable type.
I change it to - FilteredRows as System.Collections.Generic.IEnumerable<System.Data.DataRow>:
Linq query:
FilteredRows = (From d In MainDT.AsEnumerable
Group d By k=d("UPDATED_BRN").ToString.Trim Into grp=Group
Let check = grp.Any(Function ( r ) CheckOrderDT.AsEnumerable.Any(Function (x) x("ACCNT_ID").ToString.Trim.Equals(r("ROW_ID").ToString.Trim )))
From g In grp
Let ra = New Object(){g(0),g(1),g(2),g(3),g(4),g(5),g(6),g(7),g(8),g(9), If(check, "Available",g(10))}
Select ResultDT.Rows.Add(ra))
ResultDT = If(FilteredRows.Any, FilteredRows.CopyToDatatable, MainDT.Clone)
Hope anyone can help me on this. Very much appreciated.