GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The FindInTable function linearly scans a two-dimensional table and attempts to match an entry based on specified metrics.
Syntax/Parameters
Syntax
int = FindInTable ( string array, string pattern, [int column] | [string column],
[int mode], [int start]
);
int = FindInTable ( int array, int value, [int column] | [string column],
[int start] );
Parameters
array
An array of string or int data which must resolve to a two-dimension array.
data
A string or int to search for within the table (array).
column
An optional string or zero-based int specifying the column to match search position. If a string is provided, it must specify an existing row key name. If omitted, the first column (0) is used as the match.
mode
An optional int specifying a match mode as defined below. The default is FIND_EXACT, which searches for an exact case-sensitive match. The mode codes are as follows:
Term | Ordinal | Description | ||||
FIND_EXACT | 0 | Match Exactly (for integer searches this is the required mode). | ||||
FIND_NO_CASE | 1 | Not Case-Sensitive | ||||
FIND_WILD_CARD | 2 | Use Wild Card Matching | ||||
FIND_WILD_CARD_NO_CASE | 3 | Use Wild Card Matching, No Case | ||||
FIND_PARTIAL | 4 | Match Loosely/Partially | ||||
FIND_PARTIAL_NO_CASE | 5 | Match Loosely/Partially, No Case |
This parameter may only be used with string searches. Use caution when using integer mode to not confuse the mode and start parameters since they are the same type. Do not use this parameter with integer data types.
start
An optional zero-based int specifying the starting search position (first dimension, row or X position).
Return Value
Returns an int specifying the matching row index position or -1 if the item is not found or on failure. Use the GetLastError function to retrieve error information.
Remarks
The search range is from the optional specified starting position to the last element. Elements from the last written item to the allocated end are not searched.
Since the return index can be -1 on error, it is imperative to check for an error prior to referencing the array with the returned value. If the item is not found, -1 is returned and the GetLastError function will return the error code ERROR_EOD.
When searching in an integer based table, the match parameter can be any size up to a 64-bits. In addition, the mode must be FIND_EXACT.
The FIND_PARTIAL and FIND_PARTIAL_NO_CASE modes look for the pattern inside the specified column string. If it matches, the items is considered found.
Important: The mode parameter cannot be used with integer searches. Programmers should exercise care not to add a mode parameter which could be mistaken for the start parameter, thus resulting in unpredictable behavior.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Page revised 2024-10-21
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.