Update column "Comments" based on the search condition from column "Reason Code" using LINQ

Hi All,
I have a situation where in column “Reason Code” if the value is “T9” then my value in column Comments should be “I love UIPATH”** using LINQ only since I don’t want to use for each because my file contains more than 20000 rows.

The comments has different values already, however I need to update it to a single value “I love UIPath”

As always appreciate your support and guidance. I had gone through some of the posts but could not understand.



How about the following?


dt.AsEnumerable.Select(Function(r) dt.Clone.LoadDataRow({r("ReasonCode"),if(r("ReasonCode").ToString="T9","I love UiPath",r("Comments"))},False)).CopyToDataTable()

Sequence.xaml (7.9 KB)


1 Like

@manjesh_kumar - Here you go…

  1. Build Datatable - this is just to show you here. You have to use Read Range and save it to Datatable…

  1. Invole Code…


dtInput.AsEnumerable().Where(Function(row) row(0).ToString.Equals("T9")).ToList.ForEach(Sub(row) row(1) = “I love UIPATH”)

My Output - Again, you can replace it with Write Range…


Hope this helps…


Dear @prasath17 ,

Thank you very much, it is working as expected and now I am getting a little feel of the LiNQ queries.

@Yoichi : Thank you very much for your solution too appreciate that, I found the solution from @prasath17 much simpler from my perspective.


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.