How to append string in linq for data table using uipath

dt.Select(“ColumnC=‘Open’”).ToList().ForEach(Sub(row) row(“ColumnA”)= row(“ColumnA”))

when i try to append some string value in " row(“ColumnA”)) " it is not accepting to append string . kindly help me

Hi @Aravinthan,

What is the error you are getting?

Do these steps instead…

  1. Copy the required items to a new datatable as dtNew =‘ColumnC’ = ‘Open’).CopyToDataTable()

  2. Loop using for each row activity and get the required value as row(“ColumnA”)

  3. Use assign activity to assign to the linq string as LinqVariable = row(“ColumnA”)

For eg:

iam filtering columnC as “Open” and filter all the 100 rows in below query and update the 100 rows as"test" in columnA and my prob is i need to append new string with the ColumnA
dt.Select(“ColumnC=‘Open’”).ToList().ForEach(Sub(row) row(“ColumnA”)= “test”

So, if your column A value is lets say “Dummy”, you want to update it as “Dummy test”…

Am i right?

yes absolutely without looping bcz linq query is working but i cant append any value like shown below it showing error kindly help bro

dt.Select(“ColumnC=‘Open’”).ToList().ForEach(Sub(row) row(“ColumnA”)=“test”+ row(“ColumnA”))


Linq is for filtering rather than updating , still you can use the select method to do minor assigning action.

(From x As datarow In DT Where x("ColumnC").ToString.Equals("Open") Select DT_test.clone().rows.Add({x("ColumnA").ToString+"_test",x("ColumnB"),x("ColumnC")})).copytodatatable

Note: To do the query in this way , column name should be static.

1 Like

Thanks guys … I have done with string.Format…

dt.Select(“ColumnC=‘Open’”).ToList().ForEach(Sub(row) row(“ColumnA”)=String.Format("{0}.09" , row(“ColumnA”).ToString))

1 Like


Check this xaml. (10.5 KB)

1 Like

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