Select to view content in your preferred language

Comparing attribute field order between two feature classes

864
2
06-29-2017 03:39 PM
MarkMiller4
Occasional Contributor

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.

Mark

0 Kudos
2 Replies
JonathanQuinn
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:

MarkMiller4
Occasional Contributor

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