GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The SortTable function sorts a table as a two-dimensional string array by the first axis (AXIS_ROW) using specified columns.
Syntax/Parameters
Syntax
int = SortTable ( string table[][], int mode, int column | string column, [...] );
Parameters
table
An array of string data which must resolve to two-dimensions.
mode
An int specifying the mode to sort the table. See Remarks below.
column
Either int or string values specifying one but not more than three columns. The specification can be an int as a zero-based columns index or a string as a key name. The first specified column is used for the primary comparison. If the first specified column has equal data, the next column is compared. If a key is specified, it must exist.
Return Value
Returns an int as 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 (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, ...”.
When sorting as date, the date is converted in a loose mode to a qword date format and compared. If both items fail to convert tot a date, the string values are compare with case sensitivity. If one converts, the date is preference to be after the sort of the string.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.