0

I have received a shapefile from a third party that contains a column of alphanumeric characters. ArcMap has it listed as a 'string' in the field properties. The numbers range from 1-6000 with a combination of letters after the numbers. So it looks like:

1
10
100
1000
1001

Then the list continues in a random order and it includes letters at the end such as:

1387a
6176b

I'm trying to find a way to sort this properly? Would I be best splitting it and then sorting and concatenating it again? Is there any easier way to sort this column?

  • split numeric and letter part in two news columns and create advanced ordering on this new column – GeoStoneMarten Nov 30 '15 at 17:27
  • Please edit the question to clarify whether the table is in "random order" or just lexical order for ASCII text. – Vince Nov 30 '15 at 17:37
1

You want understand how it work. [a-z] is ordering after [0-9] and text is ordering by left to right position

In fact, if you don't split you have (in ascending)

- 600
- 609
- 6000
- 6001
- 6009
- 600A
- 602B
- 603Z
- 69Z

After splitting, you have (in ascending with same ids)

- 69, "Z"
- 600, ""
- 600, "A"
- 602, "B"
- 603, "Z"   
- 609, ""
- 6000, ""
- 6001, ""
- 6009, ""

Also, if you need ordering with separate number and text part you can create 2 new columns. 1st content numeric part. 2nd content letter part.

enter image description here

Ordering is not persistent

If you need a persistent ordering, you need create New FeatureClass but it's useless. Or fix your id column with fixed len char

So, if you need ordering in one column and fix position you can add "-" after all ids if this id doesn't end by letter (and if you add only one ending letter) and add 0 before number to have a fixed len char based on max character contains on id

- 0069Z
- 0600-
- 0600A
- 0602B
- 0603Z  
- 0609-
- 6000-
- 6001-
- 6009-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.