GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The CSVIsLastField function checks to see if any more data is available in the current record buffer.
Syntax/Parameters
Syntax
boolean = CSVIsLastField ( handle hCSV );
Parameters
hCSV
A handle to a valid CSV Object.
Return Value
Returns a boolean value as TRUE if there is no more data in the record buffer or FALSE if there is data. On error, the function returns TRUE, use the IsError, IsNotError or GetLastError function to retrieve a formatted error code.
Remarks
The CSVIsLastField function can be used preemptively to check if the source fields have been exhausted prior to calling the CSVGetStringField or CSVGetNumericField functions. The function considers the end of a row (line) as a last field.
When serially reading data from a CSV Object, the program must force an out of data condition to get the object to move to the next condition. As such, after an affirmative condition on a last field check, CSVGetStringField should be called to force the object to advance to the next record. For example:
handle hCSV; string s1; int rx, cx; s1 = "(insert your sample filename and path)"; s1 = FileToString(s1); if (IsError(s1)) { MessageBox('x', "Error %08X opening source\r\r", GetLastError(), s1); exit; } hCSV = CSVCreate(s1); while (CSVIsLastRecord(hCSV) == FALSE) { rx++; AddMessage("Row %d", rx); cx = 1; while (CSVIsLastField(hCSV) == FALSE) { s1 = CSVGetStringField(hCSV); AddMessage(" %d : %s", cx, s1); } CSVGetStringField(hCSV); }
Notice at the bottom, as the field loop exits, there is a call to CSVGetStringField to force the object to the next record.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Page revised 2024-12-13
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.