Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter EightData Functions (continued)

SortList Function

Overview

The SortList function sorts a list as a single-dimension array.

Syntax/Parameters

Syntax

int = SortList ( string list[], [int mode] );

Parameters

list

An array of string data which must resolve to one-dimension.

mode

An optional int specifying the mode to sort the table. See Remarks below. The default is text, ascending, with case sensitivity.

Return Value

Returns an int ERROR_NONE or a formatted error code. Use the GetLastError function to retrieve error information. The GetLastErrorMessage function can return additional error information.

Remarks

The sort is performed via one of four types with various options. Whatever mode is selected, it is applied to all columns in the sort specification.

The codes are as follows (a single type can be ORed with options):

  Term   Code   Description  
  Types (select one)          
    SORT_ALPHA   0x00000000   Sort As Text  
    SORT_ALPHA_NUMERIC   0x00000001   Sort As Text Expand Numbers — Numeric values are blown out for comparison such that 12 will precede 100.  
    SORT_NUMERIC   0x00000002   Loose Numeric Matching — Each field is converted to a number using the logic of TextToInteger and then compared.  
    SORT_DATE   0x00000003   Date Mode — Each field is converted to a date value using the loose conversion and then compared.  
  Options        
    SORT_ASCENDING   0x00000000   Ascending Order (default)  
    SORT_DESCENDING   0x00001000   Descending Order  
    SORT_NO_CASE   0x00004000   Not Case-Sensitive (does not apply to SORT_NUMERIC or SORT_DATE)  

Note that key index positions are not altered by the sort.

The SORT_ALPHA_NUMERIC type expands each number with zero leaders such that 1 and 10 do not group together. For example, in normal sort by binary character values, “a1, a10, a11, a12, a2, a3, a4, ...” as opposed to the more desirable “a1, a2, a3, a4, ... a10, a11, a12, ...”.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic