How to create existing column with same data and rename it in dattable using uipath

For eg datatable as ColA,ColB,ColC it should create Colc again and rename it as “Proj” with same data

Input
Name Value Description
Aravind Ram Chennai
Sekar Shan Pondy
Output
Name Value Description Proj
Aravind Ram Chennai Chennai
Sekar Shan Pondy Pondy

Hi @Aravinthan

Use invoke method and dt.columns and set ordinal as type in collection add the string var

Thanks
Ashwin.S

will you please the exact code syntax

Hey @Aravinthan,

Iterate through the data table columns and replace the COLC.

Please have a look at the screenshot below:

Hi @Aravinthan
Use in datatable as row(“colC”).ToString.expression=“proj”

Then use write range

Thanks
Ashwin.S

how to get the same colc row values in proj column

Hey @Aravinthan,

You are just changing the column name.Data is still at the same place.no need to write additional code.

Iam actually recreating ColC as project with same colC values

Input
Name Value Description
Aravind Ram Chennai
Sekar Shan Pondy
Output
Name Value Description Proj
Aravind Ram Chennai Chennai
Sekar Shan Pondy Pondy

Hi @Aravinthan,

Use Add Data Column Activity to add the Proj column and then iterate the datatatble using for eachrow and assign the values to new data column.please find the screenshot below for further reference:

@Aravinthan

Check the Workflow

Final.xaml (8.0 KB)

getting below issue it is not copying description values and pasting in project column
image

Hi bro i have changed the linq query as below and it works thank you

(From x In dt2.AsEnumerable()
Select dt2.Clone.Rows.Add({x.Item(“Name”),x.Item(“value”),x.Item(“Description”),x.Item(“Description”)})).copytodatatable

@Aravinthan

Sorry i forgot to add string.join

(From x In dt2.AsEnumerable()
Select dt2.Clone.Rows.Add({String.Join(“,”,x.ItemArray),x(“Description”)})).copytodatatable

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.