How to Rename a Field in Attribute Table Using Model Builder?

8142
6
Jump to solution
07-16-2013 08:05 AM
KaelDowdy
New Contributor III
I am wanting to be able to, in an automated fashion through a Model or other means, rename a field in an attribute table once the dataset is created. 

I have read in earlier versions of ArcMap, the only way to "rename" a field would be to add the new field, copy over the data, and delete the old field, and this functionality was added to 10.x whereby you can manually rename a field using ArcCatalog.  However, I'm wanting to rename a field within a Model.

There's an older article at http://ideas.arcgis.com/apex/ideaView?id=0873000000087wgAAA which indicates this functionality at one time did not exist, but now that you can do it manually, did Esri implement the ability to do it using some tool or other means?
0 Kudos
1 Solution

Accepted Solutions
JimCousins
MVP Regular Contributor
The historic workaround to renaming a field is to create a new field with the name you want, calculate its value equal to the original field, and then delete the original field. All possible in python.
Regards,
Jim

View solution in original post

0 Kudos
6 Replies
RichardFairhurst
MVP Honored Contributor
I am wanting to be able to, in an automated fashion through a Model or other means, rename a field in an attribute table once the dataset is created. 

I have read in earlier versions of ArcMap, the only way to "rename" a field would be to add the new field, copy over the data, and delete the old field, and this functionality was added to 10.x whereby you can manually rename a field using ArcCatalog.  However, I'm wanting to rename a field within a Model.

There's an older article at http://ideas.arcgis.com/apex/ideaView?id=0873000000087wgAAA which indicates this functionality at one time did not exist, but now that you can do it manually, did Esri implement the ability to do it using some tool or other means?


This is the only help I see on the subject and it only applies to manually renaming a field through ArcCatalog properties.
0 Kudos
KaelDowdy
New Contributor III
This is the only help I see on the subject and it only applies to manually renaming a field through ArcCatalog properties.
I was afraid of that, but wanted to run it by the forums to see if there was anything I overlooked.

What about from within a Python script?  Any method that will change the schema of a defined table?

So, let me go a different direction and describe more specifically what I'm wanting to do and see if that gets me what I want...

I have a dataset containing work orders and pipelines.  One work order can have one or more pipelines.  Also, one pipeline can have one or more work orders.  I've already done the spatial joins to determine the relationships.  While building a model to automate some analysis on the data, I use the Summary Statistics tool to generate a dataset that gives me a list of unique work order numbers along with a count of pipelines per work order and a sum of all the pipeline's lengths within a particular work order.  The field that gets generated containing the counts is called FREQUENCY and is automatically created.  This is the field I'm wanting to change to make it more descriptive, such as COUNT_OF_PIPES. 

From within just the summary table, I understand what FREQUENCY represents.  However, I'm needing to perform other statistical summaries and will have various "FREQUENCY" fields representing different counts.  While these counts will be in different datasets, I'm going to eventually merge some of these tables together to get a single dataset having multiple "count" fields.  This is where things can get a little confusing as I think merging the fields with the same column name will yield names like FREQUENCY_1, FREQUENCY_2, etc.  Plus, this column is not entirely self-describing without understanding the context of what's contained in the scope of the dataset. 

That said, is there a way to change the column name that gets created during the Summary Statistics step and have the counts column renamed on the fly to something other than "FREQUENCY"?  If so, that would solve my problem...although it would still be nice to be able to change column names under normal circumstances...
0 Kudos
JimCousins
MVP Regular Contributor
The historic workaround to renaming a field is to create a new field with the name you want, calculate its value equal to the original field, and then delete the original field. All possible in python.
Regards,
Jim
0 Kudos
KaelDowdy
New Contributor III
The historic workaround to renaming a field is to create a new field with the name you want, calculate its value equal to the original field, and then delete the original field. All possible in python.
Regards,
Jim
Thanks, Jim for the info -- that's probably the route I will take.  It won't take too many more clock cycles to do the create/copy/delete field approach; I just wanted to shorten the process, I guess...

This is the only help I see on the subject and it only applies to manually renaming a field through ArcCatalog properties.
Thanks for your help too, Richard.  I think you helped me out on here not too long ago...

Kael
0 Kudos
StefanoMauri
New Contributor II
You can also use this geoprocessing tool by Chris Fox: Rename Field Geoprocessing Tool (10.1).
New functionality was added at 10.1 to allow users to change the field name, but this is currently only exposed in the user interface.
With this you can rename field as you can do in ArcCatalog user interface.
Regards,

Stefano
0 Kudos
SimonFonji
New Contributor III

Alter Field (Data management) will enable you to change the field names and aliases. I used it in ArcGIS version 10.2 and higher.

0 Kudos