Concatenate rows into single string


Hi, I have a set of data that is structured as many rows in a single column within a data table that I need to concatenate into a single row, separated by a semicolon. What is the best way to do this in UiPath. Below is an example how the data is currently structure and how I need to re-structured:

Currently structured in data table:

How I need it restructured:

Thank you for your assistance!

How to convert a table to a single line with datas being separated by comma
How to print the first column from csv file in uipath

string CommaRow=string.Join(",",dtSample.AsEnumerable().[Select](Function(s) s.Field(Of String)(“name”)).ToArray())


Thanks for the reply. However I was not able to make it work. This is what I entered:

String CommaRow=String.Join(";",dtOpenCases.AsEnumerable().Select (“nCaseID”)).ToArray())

with dtOpenCases as the name of my data table and nCaseID as the name of the column I am referencing in the example above. UiPath is giving me an error under Row=String saying that it is expecting a period but when I replace the = with a period, I still receive the same error.


Thiis doesn’t work for you in Assign? Copy Paste

string CommaRow=string.Join(",",dtOpenCases.AsEnumerable().[Select](Function(s) s.Field(Of String)(“nCaseID”)).ToArray())

CommaROw.xaml (5.9 KB)

Copying entire Column from Datatable

The code in your example worked! I needed to add Function(s) before s.Field. Thank you!!


Great example! Could you please help me extend it, so that output will come in quotes like “John”,“Jane”,“Albert”…etc.

Foreach loop output as array instead of string.join

If above example is working for you then, this is one way to achieve your req.

chr(34)+string.Join(chr(34)+","+chr(34),dtOpenCases.AsEnumerable().Select(Function(s) s.Field(Of String)(“nCaseID”)).ToArray())+chr(34)


Great, many thanks!


by the way, is it .net notation? Maybe you could point to good resource with examples, I miss a lot not having solid .net background for making complex queries like this.


Hi Vidhya,

I am trying to run the code but I am getting this error -

CommaROw has thrown an exception

Message: Unable to cast object of type ‘System.Double’ to type ‘System.String’.

Can you help pls?


In above snippet, field is of type String. Try changing to “Of Double” in your example.

s.Field(Of String)(“nCaseID”))




Hi @Dharam_Prakash,

You probably just need to update where it says “s.Field(Of String)” to “s.Field(Of Double)”. That should take care of it.


Thanks maan! Sorry got your name wrong.

closed #14