Attribute Table Not Sorting Correctly

3988
5
12-05-2019 09:52 AM
DaveSelvidge
New Contributor III

When sorting an attribute table, the "sort" doesn't work correctly. Some of the numbers are in the correct order but others clearly are not. Below is data from 3 different sources. I right-clicked the column title and chose "Sort Ascending" from the pop up menu. It appears the first digit (digit on the left) is being sorted correctly. I'm thinking that maybe if we change all of the numbers to decimals (1.0 insead of 1,16.0 instead of 16) it may fix it. However, I'm not the person in my company that makes those changes. I dont make or edit the data, I merely use it - well I try to at least.

water main diametersGravity Sewer diameters

Pressurized Sewer Diameters

Has anyone else had this issue? I had originally assumed it was an ArcPro specific issue, however if I export the attribute table to Excel I get the same results. 

0 Kudos
5 Replies
JoeBorgione
MVP Emeritus

That's a text type of field, not numeric.  I think it's sorting correctly; for text....

That should just about do it....
DaveSelvidge
New Contributor III

Thanks for the quick response. I do believe you are correct. My supervisor was asking me why it would be dsorting this way. I told him I wasn't sure but I have a suspicion that it has something to do with when/how the data was originally entered. That led to briefly explaining the importance of attribute rules / constraints and so on. 

0 Kudos
JoeBorgione
MVP Emeritus

Using numeric values in a text defined field is a pet-peeve of mine. (The give-aways are things like the '<' sign as well as the word 'UNKNOWN' and 'OTHER'.)  If your boss wants to sort numeric values properly, (s)he needs to understand basic database design, and define the fields accordingly.  If there is a business case that needs UNKNOWN and/or OTHER, your'e kind of stuck with what you got.

That should just about do it....
MatthewDriscoll
MVP Alum

Adding zeros in front should fix this.  2 should be 02 or 002 if your numbers hit the hundreds.

Kyle_LocGov
New Contributor III

Good suggestion Matthew, thanks for jumping in. 

0 Kudos