How IDs and Codes Are Sorted

When you defined IDs and codes, it is important for you to know how they appear in a combo box list after they are sorted. Traverse sorts alphanumeric data alphabetically by comparing first characters, then second characters, and so forth. When two alphanumeric characters are compared, the characters with the smaller ASCII value comes first in the alphabetic sort.

The list of alphanumeric characters is in ascending alphabetic order:

  • Special characters (-, *, /, and so forth)
  • Numbers (0-9)
  • Uppercase letters (A-Z)
  • Lowercase letters (a-z)

Alphabetical rules are not intuitive when numbers are involved. For example, in numerical sorting 60 comes before 112; in alphabetical sorting 112 comes before 60. To ensure that numbers appear in the same order in both an alphabetic and a numeric sort, pad numbers to the left with zeros until they are the same length. For example, if 60 is defined as 060, 060 comes before 112 in both an alphabetic and numeric sort.