

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorting Alphanumeric Data
May 10, 2022 3:23:50 PM
Dec 1, 2014 10:49:58 PM
QlikView and Qlik Sense do not apply strict alphabetic (ASCII) sort order for alphanumeric values. Instead alphanumeric values are sorted in a natural sort order, where numerical parts are sorted based on their entire numerical value rather than per digit.
During sorting the alphanumeric string is broken into parts, where a part contains either all alphabetic characters or all numeric characters. These parts are then compared against each other. If both chunks contain numbers, a numerical comparison is used. If either chunk contains characters, the ASCII comparison is used.
For example it means that data like street addresses get sorted in a natural order base don the street number. As shown in the example below the value 8 is considered smaller than 22, base don their numerical values rather than the opposite based on their text values.
Reference:
- Natural sort order, Wikipedia; https://en.wikipedia.org/wiki/Natural_sort_order
Environment:
- Qlik Sense - all releases
- QlikView - all releases
Resolution
Strict sort order can be accomplished by reusing loaded data order, which can be controlled by data source for example by applying SQL ORDER BY clause.
During data load the order can be saved by utilizing the loaded Record Number.
The loaded record order can then be used as sorting order, by applying it as an expression to sort by.