Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter EightData Functions (continued)

ListIsSubset Function

Overview

The ListIsSubset function test that set b is a subset of set a.

Syntax/Parameters

Syntax

int = ListIsSubset ( var a[], var b[], [dword options] );

int = ListIsSubset ( 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 TRUE (1) of b is a subset of a or FALSE (0) on failure.

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 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 b has duplicate members where only one exist in a, this is not counted as false.

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.

Related Functions

Platform Support

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

Legato IDE, Legato Basic