GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The ListIntersection function takes two lists or two strings containing lists and performs a mathematical intersection operation.
Syntax/Parameters
Syntax
var[] = ListIntersection ( var a[], var b[], [dword options] );
string = ListIntersection ( string a, string b );
Parameters
a
Either an array of data which must resolve to one-dimension or a string containing a list of items. See remarks for information on data types.
b
Either an array of data which must resolve to one-dimension or a string containing a list of items. See remarks for information on data types. This parameter type must match the the type for parameter a.
mode
An optional int specifying the mode to sort the data. See Remarks below. The default depends on the data type of the a and b parameters. The mode parameter only applies to string types.
Return Value
Returns either an array or a string depending on the dimensionality of the a and b parameters.
When arrays are used, the return value will be the same type as the a and b parameters. An empty set is returned on error or if the result is an empty set.
If a and b are simple strings, then the result is a string type. An empty string is returned on error or if the result is an empty set.
Use the GetLastError function to retrieve error information. The GetLastErrorMessage function can return additional error information.
Remarks
Parameter list a is sorted to optimize comparison. The order is not import and but it can be controlled with the sort parameters.
The result will be in the order of parameter list b.
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) |
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, ...”.
The sort type must match the data type. If it does not, a warning will be placed in the last error message.
If either list contains duplicate items, they are removed. Note that is the SORT_NO_CASE is set, duplicate items that differ by text case will be reduced to a single item. There is no guarantee as to which item will be in the final list.
When simple strings are used, the delimiter is automatically determined by: (i) if a return is found (0x0D), the data is assumed to be records delineated by line breaks; (ii) if a comma is found, the data is assumed to be comma separated values (CSV); (iii) if spaces are found, spaces are used as delimiters; and finally, (iv) is none of these are found, it is assumed to be a single item or an empty set.
Delimiter of parameter a is used for primary output delimiter. Failing that, parameter b delimiter type is used. Failed to determine either (i.e., a and b contain a single word), commas are used. Blank items are removed.
Key names are not preserved in the operation.
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.