Insert linebreak after each item in collection when writing to datatable cell

I have a collection of strings that I write to a datatable, but I would like each item on a seperate line

The output at this point is like this

I would like to have the lines in seperate rows so that they are easier to read and compare
Here illustrated with red vertical lines.


Assign a variable and store the value in that variable as below

Datavariable(6) = DatatableVariable(6).ToString.Replace(" ", “-”)

Hope this may help you



Sorry No need of Variable, just use assign and write as below

Datavariable(6) = DatatableVariable(6).ToString.Replace(" ", “-”)

so the replace value will be assigned directly to the column

that you can use use

Hope this may help you


Hi @Michaeljep

use this syntax in assign activity inside for each row

Currentrow(6)=Currentrow(6).ToString.Replace(" ",Environment.newLine)


I can’t get it to work, maybe it’s because of the way I’m adding the collection to the datatable.

I use String.Join to add the datarow to my datatable.

{CurrentRow.Item(“Fakturanummer”).ToString,Regnr,CurrentRow.Item(“Værkstedrapportnummer”).ToString,VærkstedsrapportTotalBeløb,TaksatorRapportNummer,TaksatorTotalBeløb,String.Join(" “,VærkRapportCollection),String.Join(” ",TaksRapportCollection)}

No matter if I add Environment.Newline in the Add To Collection activity or I use Replace(" ",Environment.newLine) when adding the datarow the output is still in one line.

Just to clarify I would like to have seperate rows inside the cell

So FRONTRUDE,7586 LIMSÆT FORRUDE,468 should be

HI @Michaeljep ,

Can we use like below. Not sure please give it a try. thanks.


That didn’t work either, I also tried “Environment.Newline” and VbCrLf, but didn’t give the expected output.