How to add a column into new datatablefrom existing datatable?

I am trying to add a column of existing datatable into new datatable.
I think data add column works well but it did not works well.
How to do that?

Example)
From Existing datatable: column(3)
To New datatable: column(1)
like column copy

Hi,

Create a DataView of your existing DataTable and assign it to new DataTable with the columns which you need.

Please find attached workflow for reference.

AddColumn.zip (8.0 KB)

Regards,
Rahamat

1 Like

Hi,

Thank you for your support.
I would like to add a few question.

1.Can we add blank column?
I would like to make Datatable such as,

-New Datatable
Column1 | Column2 | Column3
Col3 data | | Col2 data
of existing DT| blank | of existing

  1. Can we use the column number insted of column name?

Best Regards,
Takuya

Hi Takuya,

  1. To Add blank column

Capture

To change column position of this column use ‘Invoke Method’ actvity.

  1. DataView.ToTable syntax does not give the comfort to add required columns using column number/index.

Syntax : .ToTable(Boolean, String)
If true, will return distinct values for all its columns. Default value is false.

Hope this clarified your queries.

Regards,
Rahamat

4 Likes

Hi Rahamat,

Thank you for your quick response.
I can solve my problem.

Best Regards,
Takuya