How to replace a value in datatable in Uipath without using for each row

Hi
Welcome back to uipath community
There are actually two ways of doing that
—first is convert the datatable to a string with the help of OUTPUT DATATABLE ACTIVITY and pass the datatable as input and get the output variable of type string named str_output
—now use a normal assign activity like this
str_output = str_output.ToString.Replace(“your old value”,” your new value”)

Now use GENERATE DATATABLE ACTIVITY and mention the str_output variable as input
And get the output with a variable of type datatable named Finaldt

Or

Use a assign activity like this if we know which column values we want to replace
dt = dt.AsEnumerable().Where(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Replace(“your old value”,” your new value”).ToString).CopyToDatatable()

Cheers @Rachel7

10 Likes