logo
Powered by QM on a Rpi server

KnowledgeBase 00109: SSELECT Sort Order

Last updated: 22 Jul 2016
Applies to: Release 3.2-1 onwards
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

The standard behaviour of the QMBasic SSELECT, SSELECTN and SSELECTV statements is to perform a simple ascending left aligned sort. Applications frequently need to produce lists that are sorted in different ways and tend to do this by executing a query processor SELECT command.

Three useful options have been added to the QM implementation of these statements that may remove the need for an executed query processor command. Although these options are described separately below, they can be used together in any combination.


Right Aligned Sorting

QM release 3.0-0 added a RIGHT.ALIGNED option

   SSELECT file.var {TO list} RIGHT.ALIGNED 
This option causes the statement to return a list of items sorted using a simple right aligned comparison in which integer numeric items are sorted by numeric value and all other items are sorted by padding the shorter item with leading spaces and then performing a left to right comparison.


Descending Sorting

QM release 3.1-0 added a DESCENDING option

   SSELECT file.var {TO list} DESCENDING 
This option causes the statement to return a list of items sorted into descending order.


Case Insensitive Sorting

QM release 3.2-1 added a NO.CASE option
   SSELECT file.var {TO list} NO.CASE 
This option causes the statement to process alphabetic data in a case insensitive manner, effectively comparing uppercase versions of the data internally. On ECS systems, case pairing is defined by the currently selected character map. It is therefore possible for different users of the same application to see different sort orders, perhaps to honour local language conventions.


Related Articles

None.



Please tell us if this article was helpful
Very     Slightly     Not at all
Comments
Email (optional)