How To: Create a sequentially ordered ID field on a sorted table in ArcView GIS
Note: The information in this article applies to ArcView GIS versions 3.x only. The instructions described apply to the Avenue programming language, which is specific to the ArcView GIS application.
This article walks through the process of creating a sequentially ordered ID field, which is based on the order of the records after a sort, and not based on the internal VTab record number that the Rec command uses.
- Sort the table on the desired field. Use the Ascending or Descending sort buttons:
- Add a new number field to the table.
- Open the table and select Start Editing from the Table menu.
- Select Add Field from the Edit menu.
- In the Field Definition dialog box:
- Set Name to an appropriate name, for example 'Area'.
- Set Type to Number.
- Set Width to an appropriate number, for example, 32.
- Set Decimal Places to the desired number, for example: 6.
- Click OK.
- Select Stop Editing from the Table menu and save the edits.
- Select the new field field, and click the Field Calculator button.
- Type in this calculation expression:
Note: The 'av' in the code is referring to the Avenue object, used for instantiating a function.
Note: Replace MyTable in the expression above with the name of the table.The Field Calculator populates this new field with a sequentially ordered ID value based on the new sorted order.