Better sorting of numbers in table frame

430
4
02-12-2024 12:46 AM
Status: Closed
Labels (1)
NellieSofie
New Contributor II

I have a list of points with addresses that want to list in a table frame. When I sort these by the adress they are sorted like: Address 1, Address 10, Address 11, Address 2, Address 20, Address 3 etc.

This does not make sense,as they should be sorted 1, 2, 3, 10, 11, 20 etc.

Tags (2)
4 Comments
DanPatterson

it is referred to as a "natural sorting" or "natural sort order"

MErikReedAugusta

To expand a bit on Dan's explanation, you have two options to address your issue:

  1. Create a new field with nothing but the numbers from that Address field (make sure they're actual numbers and not TEXT, or else you'll have the same problem), and sort based on that.
  2. "Pad" your numbers with zeroes on the left such that you always have the same number of digits.  If your highest number is 100, then you'll need 3 digits for everything: 001, 002, etc.  If your highest number is 85, then you only need 2 digits: 01, 02, etc. 
DanPatterson

and to expand on that answer, I provided some variants in this thread

Solved: How can I naturally sort alphanumeric values in a ... - Esri Community

which leaves a situation where there is no simple way to "naturally sort" because there are variants in input data sets which makes a general solution hard to implement

AubriKinghorn
Status changed to: Closed

Closed, as the comments explain this is how text is sorted vs numeric fields.