GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The CSVReadTable function reads the entire contents of a file into a two-dimensional table.
Syntax/Parameters
Syntax
float[][] = CSVReadTable ( handle hFile | string name, [dword flags] );
int[][] = CSVReadTable ( handle hFile | string name, [dword flags] );
string[][] = CSVReadTable ( handle hFile | string name, [dword flags] );
Parameters
hFile
A handle for a Basic File Object, or
name
A string specifying a fully qualified filename to read or a string containing CSV data.
flags
An optional dword that specifies various options. The default is 0x00000000, or nothing. The flags parameter can be set to CSV_WT_KEY_NAMES_TO_HEADER and the first line will be treated as key names.
Return Value
Returns an array of float, int, or string tables containing a copy of the CSV text or an empty array on failure. Use the GetLastError function to retrieve error information.
For non-string types, the data must be converted to the destination type. As such, the last error should be checked for ERROR_SYNTAX. The low word of the formatted error code will contain the syntax error count. The last error message will contain the location of the first error.
Remarks
Note that this function does not require a handle to a CSV Object. The data is read into a string table which can be managed through array functionality.
If CSV data is provided for the name parameter, it must contain at least one full record end with a line break.
If the destination is not a string type, it is possible to have type data type errors if the data in the CSV file does not match the incoming data type. If an error occurs, it is set into the last error code and message. The error message from the script engine will contain the zero based position within the destination array.
If the incoming data is UTF-8, the header is removed and the last error will contain CSV_WT_ADD_UTF_8_HEADER flag.
The flags parameter can be set to CSV_WT_KEY_NAMES_TO_HEADER and the first line will be treated as key names. The names must follow key naming convents and also cannot contain ‘{’ ‘}’ ‘,’ or ‘;‘ characters.
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.