I have a 2 datatable consider dt1 and dt2,I need to compare the column1 of dt1 with column1 of dt2 and update the column2 of dt1 with column2 of dt2.I am able to update the value but in dt2 there is a 2 matching value,so I want to take the very first match and update .
Please help me for linq query.
Dim dt2Lookup As Dictionary(Of String, Double) = dt2.AsEnumerable() _
.GroupBy(Function(row) row.Field(Of String)("column1")) _
.ToDictionary(Function(g) g.Key, Function(g) g.First().Field(Of Double)("column2"))
For Each row In dt1.AsEnumerable()
Dim key As String = row.Field(Of String)("column1")
If dt2Lookup.ContainsKey(key) Then
row("column2") = dt2Lookup(key)
End If
Next
Hereβs the zip of workflow containing your required output.
Note in invoke code assign your 2nd datatable(where you need to get output) to βdt1β(In the arguments of Invoke code activity). As final output is going to be stored in βdt1β of the invoke code.
Let me know if you have any doubts