How to join two different columns into one

I have a datatable containing two column

Column A Values of column A is ABC,
Column B Values of column B is 123.

In Column C i need to enter value as ABC-123.

Is there is any easy way to do this other than For loop. Kindly help

DataColumn.Expression Approach can be an option

How to Update Data Column Values of a Data Table | Community Blog

Thanks for this ,But i dont get it right.Can you please help

(From d In dtReport2.AsEnumerable
Let gp = d(“Column A”).ToString.Append(d(“Column B”).ToString).ToArray
Select dtReport1.Rows.Add(gp)).CopyToDataTable


Try using Invoke code Activity, please refer below Image.
Hope this Works!

1 Like

we didn’t mention and would not recommend.

When doing datatable reconstruction the new ItemArray would be like

Let gp = {d(0), d(1), String.Format(“{0}-{1}”, d(0).toString, d(1).ToString)}
fell free to use the colname, when preferred.

We assume that you had a look on the DataColumn.Expression approach as well, as we do see it as a better solution match

1 Like

did that solution work?

The error you were getting Because. the columnC is present in your Input Datatable.
And the code I have given in that code columnC will dynamically get added.

Hi @tharani.natarajan
Here is a sample xaml zipped folder that could resolve your issue
Its resolved (13.5 KB)

I have also added you with setordinal to place the concatenated column in the excel wherever you want by mentioning the index of the column, here in this xaml i have set as 0 index so the concatenated value will be there in first column of sheet2…

Hope would help you with your issue

Cheers kindly let know if it works

Mohini :slight_smile: )
HAppy Automation: