How To: Permanently change the order of records in a feature class, shapefile, or table according to a particular field's values
The geographic features in an attribute table are arranged so each row (record) represents a feature, and each column (field) represents one feature attribute. The records can be sorted in the attribute table in either ascending or descending order by a selected field. Typically, when a field is sorted in the attribute table, the sort order is only saved to the map document and does not apply back to the actual feature class, shapefile, or table.
The instructions provided describe an option for permanently changing the order of records stored in a feature class or shapefile according to a specified field(s).
The Sort (Data Management) tool can be used to reorder, in ascending or descending order, records in a feature class, shapefile, or table based on one or multiple fields. The reordered result is written to a new dataset.
- From the Standard toolbar in ArcMap, click the ArcToolbox button to open the ArcToolbox window.
- Expand Data Management Tools > General, and double-click Sort to open the Sort tool.
Alternatively, search for Sort (Data Management) in the Search window.
- Click the Input Dataset drop-down arrow, or the browse button, and select the input feature class, shapefile, or table to be sorted.
The Output Dataset is automatically specified. To change the Output Dataset, click the browse button on the right of the Output Dataset text box, and select an output location and name for the feature class, shapefile, or table to be created.
- Click the Field(s) drop-down arrow. Specify the field(s) values used to reorder the input records, and the direction the records are sorted.ASCENDING — Records are sorted from low value to high value.
DESCENDING — Records are sorted from high value to low value.
For the Field(s) parameter, sorting by the Shape field or by multiple fields is only available with an Advanced license. Sorting by any single attribute field (excluding Shape) is available at all license levels.
Optional: Click the Spatial Sort Method drop-down arrow to select a method. This option specifies how features are spatially sorted. Spatial Sort Method is only enabled when 'Shape' is selected as one of the sort fields.
- Click OK to run the Sort dialog box.
- ArcGIS Help - Sort (Data Management)
- ArcGIS Help - How Sort (management) works
- HowTo: Create sequential numbers in a field using Python in the Field Calculator