GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Five — General Functions (continued)
Overview
The CreateSortImage function parses the incoming data and expands numeric values to the precision size. This normalizes a string for sort comparing.
Syntax/Parameters
Syntax
string = CreateSortImage ( string data, [int precision] );
Parameters
data
A string containing source data.
precision
An optional int that specifies the size of the numeric expansion. This value should be larger than the widest expected number.
Return Value
Returns a string with a normalized word, if the function fails an empty string is returned. Use the GetLastError function to retrieve a formatted error code.
Remarks
When sorting strings, numbers are counted as simple characters. Therefore, a sort will result is:
“1, 10, 11, 12, 2, 20, etc.” or “a1, a10, a11, a12, a2, a20”.
The desired result would typically be:
“a1, a2, a10, a11, a12, a20”.
CreateSortImage expands each discrete number in the string by adding leading zero padding. So the returned values would be:
“a0001, a0002, a0010, a0011, a0012, a0020”.
Thus, when sorted, the values are in the desired order. Obviously, this would be destructive to the source data. Therefore, a separate companion image string is created for each original and added to a table column. The table can then be sorted using the SortTable function.
The source data can be of any size but the result after expansion cannot be larger than 4096 bytes.
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.