How to put multiple values in a datarow


I have a datatable with one column and 2 rows with values and I want to add these 2 rows into a single row and column of another datatable.

Hi @B.D

Welcome to uipath community

Check out the XAMl file

ColumnAnother.xaml (9.9 KB)


1 Like

Hi Gokul001,

what if the number of rows in the first datatable is variable?

Can you tell more, I can’t able to understand? @B.D

like you have an unspecified number of values/rows, not just 2, like in the first example.

Hi @B.D

store number of collumn present in the datatable first

colcount = dt.columns.count

Use a for each on Enumerable.Range(1,dt.Rows.Count-1).ToArray()

Inside the loop use another loop on Enumerable.Range(0,colcount).ToArray()

Now in the inner for loop use add data column and then use assign to add data of the row to the column respectively

dt.rows(0)((colcount*currentitem)+currentItem1) = dt.rows(currentitem)(colcount).Tostring

Currentitem1 - is from the inner loop
currentitem - is from the outer loop


1 Like

I solved it in a another way.

I converted the datatable into an array, then I used String Join to comvert the array into a single string.

Thank you for your suggestions!

1 Like

Hi @B.D

If you need a single string yes thats the way…but if you need to convert row to column then this is the way

Happy Automation