Build Data Table: How to rename a column?

Build Data Table: How to rename a column and/or change other properties of the column using the GUI?

3 Likes

You can use an assign activity to do thisā€¦

myDataTable.Columns(0).ColumnName = ā€œnewColumnNameā€

31 Likes

If I defined ā€œBuild Data Tableā€ definition incorrectly , Simply I want to edit it on Studio GUI.
But UiPath Studio supports Delete and Add Column only instead of Edit after defined once.

1 Like

@octechnologist
Hi use this flow demo.xaml (14.0 KB)

3 Likes

Hi Richard, if we have to add multiple column name. Is there a simple way to it or need to put assign service to add each column name.

Thanks for the replies thus far. It still seems silly to me that we canā€™t simply edit the original ā€œBuild Data Tableā€ activity as tango mentions above.

1 Like

Can you create a list of new column names and loop through it adding each new column dynamically?

I probably couldā€¦ but my assertion is that I shouldnā€™t have to.

Is there some reason Iā€™m not getting why we shouldnā€™t just expect to be able to edit the contents of the ā€œBuild Data Tableā€ activity, and have it behave differently on the next robot run?

Yeah sorry, I misunderstood.

Itā€™s in ideas - please bump and upvote to possibly influence when it will happen (BTW - I totally agree with you on this one):

2 Likes

I am facing the same problem. I defined 12 columns in a data table and now I want to edit the datatype of second column. There should be a way to edit existing columns.

Hi @rohan.joshi,
If you changed the datatype after you added the data, I think you will get an error like.
ā€œCannot change DataType of a column once it has dataā€. You have another way that you can create a new column like existing colum name +ā€œtempā€. Copy all the data to the new column that you decided data type. finally remove the existing column and change the new column name by old column name.

It is a little hard process . When you have huge data , may take time

Regards
Balamurugan

UiPath data tables donā€™t actually store/persist data like a physical database. They are volatile (like RAM), and only take data in real-time while a robot is running. Thereforeā€¦ changing a columnā€™s data type wouldnā€™t be constrained by persisted data.

2 Likes

Hi @balupad14,

I donā€™t have any data in the DataTable, itā€™s in memory. I just want to edit the 2nd column without deleting the other columns, from 3 to 12.

Be sure to chime in on the feature request link above if you havenā€™t already.

1 Like

Hi @rohan.joshi,
Here I have attached a sample for you.

File :DataTable.xaml (8.7 KB)

Regards
Balamurugan

2 Likes

Great that this can be doneā€¦ but I still think itā€™s a little silly that one cannot simply open the original DT builder activity and just change the column data type :slight_smile:

2 Likes

Hi, i am bit late but there pretty easy way to change datatype or columnname. You need to open your projects .xaml file with notepad and find your data table there, and simply replace datatype/name.
It looks approximately like this:
<xs:element name="COLUMNNAME" type="xs:COLUMNTYPE" minOccurs="0" />

Hi @richarddenton, i am trying this assign activity to update 3 columns however nothing happened. Can you please help out? thanks. Want to change the column named ā€œNameā€ with new name. Appreciate your help.

See below screenshots.
here is my excel:

rename1

Full editor screenshot:
rename2

Just FYI to anyone interested, the pattern Iā€™ve found myself doing to compensate for this GUI weakness is to create my DT with just 1 column (incrementing Id or a datetime, etc.) and then use multiple Add Column activities before the process proceeds and uses the DT.

This way, I can always rearrange/add/delete/update any of the columns because they are independent Add Column activities. I am free to manipulate the column names & order however I choose as my needs evolve.