I have two datatable dt1 and dt2. I want to update column C of dt2 with value of column D of dt 1 if both A and B in both datatables are matching. How can I do it through linq.
Also the optimised way of doing it through UiPath activities.
Hi @dpaktr
Try this linq query:
updatedDataTable As DataTable = (From row1 In dt1.AsEnumerable()
Join row2 In dt2.AsEnumerable()
On row1.Field(Of YourDataType)("A") Equals row2.Field(Of YourDataType)("A") AndAlso
row1.Field(Of YourDataType)("B") Equals row2.Field(Of YourDataType)("B")
Select dt2.Clone().Rows.Add(row2.ItemArray(0), row2.ItemArray(1), row1.ItemArray(2))).CopyToDataTable()
Hope it helps!!
Hi @dpaktr ,
You can edit then try it with your file
comapre_excel.xaml (17.0 KB)
regards,
LNV
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.