Update Data table in Uipath


I have a data table with 50K records. I want to update one column value basis on another column value like shown below.
IF the value of ‘Shift’ Column is ‘MSP’, I want to update ‘Tag_Shift’ Column as ‘MSP-MOB’.


Can someone help in writing Linq query.

Please help.


Linq will be the better option than for each. For each will take more time than expected to iterate all the rows @ndhiran

Thanks @HareeshMR.

Can you help with Linq Query.


@ndhiran - If it’s only 50k rows, then a for each statement is honestly what i’d recommend. It will only take a few seconds to iterate through all 50k rows using a single if statement and an assign activity.

For each row in dt1
If String.Equals(row.item("Shift").ToString.ToUpper,"MSP") Then Assign row.item("Tag_Shift") = "MSP-Mob"

@HareeshMR - I agree linq is likely going to process more efficiently, but the time savings would be minimal on 50k rows. It’s more important that the developer and ALL people that would look at and review the code in the future understand the LINQ statement which is not likely. It also would only take a few minutes max to make the for each statement vs quite a bit longer if you don’t have a good understanding of LINQ syntax

Thanks @Dave.
Currently the records are around 50 K. But later might get increase to 3 L as well.

@ndhiran As long as it stays under ~10 million or so, i’d just stick to the for each loop. Do your own stress test to see for yourself though, as processing power of your computer/server will affect the speed.

Just as an fyi, LINQ uses a for each loop in the backend processing of the query as well.