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


This article walks you 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 your table on the desired field. Use the Ascending or Descending sort buttons.
    Sort Table

    [O-Image] Sort table buttons
  2. Add a new number field to the table.

    A. Open the table and select Start Editing from the Table menu.
    B. Select Add Field from the Edit menu.
    C. 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.

    D. Select Stop Editing from the Table menu and save the edits.

  3. Select the new field field, and click the Field Calculator button.
    [O-Image] Field Calculator Button
  4. Type in this calculation expression:


    Replace MyTable with the name of your table.

    The Field Calculator will populate this new field with a sequentially ordered ID value based on the new sorted order.