Select to view content in your preferred language

How to reorder fields in a feature class with model builder

3861
4
07-14-2015 09:10 AM
JoseSanchez
Frequent Contributor

Hello everyone

How to reorder fields in a feature class with model builder?

Thanks

0 Kudos
4 Replies
FreddieGibson
Honored Contributor

I don't think there is a tool available that does specifically this without creating a new feature class. If I need to accomplish this without creating a new feature class I use python to drop and re-add the fields in the needed order. If its okay to create a new feature class I tend to manipulate a fieldmappings object to specify my needed field order in the newly create feature and then append the previous data into it.

ArcGIS Idea to add this functionality

http://ideas.arcgis.com/ideaView?id=0873000000087wgAAA

MicahBabinski
Frequent Contributor

Greetings Jose,

A while back I developed a custom script tool which could be used in ModelBuilder to reorder the fields in a shapefile. The tool uses the GDAL/OGR library from OSGeo4W.

If you are interested in diving in to custom Python script tools and open source, let me know and I can share my script.

Micah

0 Kudos
DanPatterson_Retired
MVP Emeritus

Creating a new...or overwriting an old...is the only way to do it with the methods listed above.  Should want to incorporate scripting in your model, reordering fields in NumPy arrays  is trivial.   See NumPyArrayToFeatureClass and FeatureClassToNumPyArray in the help plus others.  For an example see Before I forget ... # 3 ... Doing stuff with tabular data in array form

JasonBalmut
Frequent Contributor

It would be nice if the arrows on the Feature Class to Feature Class tool actually did what they look like they're supposed to do.