Alphabetically sorting problem

,

This snapshot shows the alphabetically sorting problem in my app. The second row should be on top. All table columns are formatted to ‘Plain text’. What am I doing wrong?

It seems that the first row and the second row has different value for the Object column.

In the right viewer, the correct sorting should be:

ELE-MOLD-CC2-C-120120
ELE-MOLD-CC2-C-185120
ELE-MOLD-CC2-C-18595

1 Like

18595 goes first because it has 5 digits only

1 Like

You are talking about sorting the text length and then sorting the texts. There is no reason to work that way. Also, I don’t think that’s the standard sorting, like in Excel and other data-applications.

captured1

1 Like

My testing also shows that sort algorithm of Google sheets and AppSheet seems to be different for text strings with the pattern you have shared.

AppSheet sorting seems to be based on absolute number value in such a string so AB-999 will appear before AB-1111

AppSheet Sort

Google Sheet sort

Google Sheet Sort

1 Like

The sorting is to be basic algorithm. I’ve used many data programs including Excel, Access, dBase, etc. They are working the same way. I would say AppSheet is weird and it confuses people when searching the sorted data. It should be no difference among others.

1 Like

AppSheet uses a sorting algorithm that attempts to “do what you’d expect” with distinct numeric text components: treat them as numbers and sort numerically. Unfortunately, those of us with a more experienced technical background don’t expect that and find it annoying. There’s no way to disable this behavior. The best you can do us work around it, perhaps by creating a separate sorting column that munges the sort keys to foil the unwanted sorting behavior (e.g., by removing the hyphens, perhaps). Alternatively, add trailing zeros to the numeric components so they sort as desired even when interpreted as numbers.

2 Likes

OK, thanks.

1 Like