I have a large datatable and I want to filter it by condition Col2 = “B” and update the resulted lines on Col3 whit “yes”
Col1 Col2 Col3
A B -
A E -
A B -
A D -
A B -
The result:
Col1 Col2 Col3
A B yes
A E -
A B yes
A D -
A B yes
I’m trying to avoid for each or other kind of loop activity.
Many thanks in advance!
(From d In builDt.AsEnumerable
Let u = If(d(1).toString.Trim.Equals(“B”),“Yes”,“”)
Select DtResult.Rows.Add(New Object(){d(0),d(1),u})).CopyToDataTable
Brilliant solution! I wasn’t aware of the columns expression method! I have marked @pravin_calvin answer as a solution because I’m more interested in the linq approach. Again, many thanks - simple and elegant solution!
p.s. I’ve read your previous answers on similar topic [LINQ query to update(replace)datatable in uipath] - really well documented.