Comparing attribute field order between two feature classes

06-29-2017 03:39 PM
New Contributor III

Is there a way to compare the attribute field order in one feature class against the order in another feature class using Python? This is essentially a schema check, but the Geodatabase Schema Compare tool in the Data Reviewer Tools Toolbox does not do this. ListFields in arcpy also does not report the fields in the order they appear in the attribute table. The geodatabase obviously maintains information on attribute field order, so is there a way to access that information?

The two feature classes have the same attribute fields, they just could be in a different order. The schema standard we use calls for a specific attribute field order (and it's not necessarily alphabetical order).

Thanks for any help/ideas.


0 Kudos
2 Replies
Esri Notable Contributor

Have you reordered the field list of the layer in the Table of Contents?  If I bring in a feature class and run ListFields on it, those results, the attribute table, and fields tab within the feature class properties all match up:

ListFields, (layer and source dataset):

Attribute table:

Feature class fields:

New Contributor III

You are correct Jonathan, ListFields does maintain the field order. I must have been thinking of another list function. Thanks for the response. -Mark

0 Kudos