How To: Create a sequentially ordered ID field on a sorted table in ArcView GIS


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.


  1. Sort the table on the desired field. Use the Ascending or Descending sort buttons: [O-Image] Sort table buttons
Sort Table
  1. Add a new number field to the table.
    1. Open the table and select Start Editing from the Table menu.
    2. Select Add Field from the Edit menu.
    3. In the Field Definition dialog box:
      1. Set Name to an appropriate name, for example 'Area'.
      2. Set Type to Number.
      3. Set Width to an appropriate number, for example, 32.
      4. Set Decimal Places to the desired number, for example: 6.
      5. Click OK.
    4. Select Stop Editing from the Table menu and save the edits.
  2. Select the new field field, and click the Field Calculator button. [O-Image] Field Calculator Button
  3. Type in this calculation expression:
The 'av' in the code is referring to the Avenue object, used for instantiating a function.
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.

Related Information