I have a dataTable with 3 columns Column1, Column2 and Column3 with 100 rows.
Column1 Column2 Column3
123 hello GoodMorning
765 heloon GoodNight
134 hey GoodEvening
123 hi GoodEvening
I wanted to replace the values of all rows in Column1 based on some condition.
Example : Replace the value with new value “1234” if the existing value is “123”
Or Replace the value with new value “1234” if the eixsting value is >120
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()
as the Where operator is expecting a boolean return from the Lambda function there will be a missmatch with the returned string from the replace method. Therefore we do get a validation error.
Also we do need a return value from every step we do formulate within the LINQ. That’s the reason why some constructs e.g. row(ColNameOrIndex) = “ABC” will not work within the assign activity.