![]() |
Powered by QM on a Rpi server |
|
KnowledgeBase 00109: SSELECT Sort OrderThis 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 SortingQM release 3.0-0 added a RIGHT.ALIGNED option SSELECT file.var {TO list} RIGHT.ALIGNEDThis 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 SortingQM release 3.1-0 added a DESCENDING option SSELECT file.var {TO list} DESCENDINGThis option causes the statement to return a list of items sorted into descending order. Case Insensitive SortingQM release 3.2-1 added a NO.CASE optionSSELECT file.var {TO list} NO.CASEThis 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 ArticlesNone. |