Table of Contents
VCursor Class: Import Export Methods
VCursor.ImportText()
Declaration:
ImportText( inFile as FolderItem, inFieldDelimiter as String = chr(09), inLineDelimiter as String = LE, inEncoding as String = "UTF-16", inHasColumHeader as Boolean = FALSE, inMaxRecordsToImport as Integer = 0 )
Parameters:
- inFile - File to be imported.
- inFieldDelimiter - Character to be used as a field delimiter, default is a TAB chr(0x09).
- inLineDelimiter - Character to be used as a record delimiter, default is the OS Line Ending.
- inEncoding - Encoding of the imported file.
- inHasColumnHeader - TRUE if the import file has a column header line.
- inMaxRecordsToImport - The maximum number of records to import.
Description:
Imports the specified text file into the fields of the Cursor.
Note: The Cursor must have the flag CanBeUpdated set to TRUE.
The parameters FieldDelimiter and LineDelimiter are optional, i.e. you may specify one of them or both. By default they are TAB (09) and the OS Line Ending correspondingly.
If the cursor represents a subset of the table-fields, then the omitted fields will be filled with NULL values if the field in NULLABLE or blank values otherwise.
Importing text to a Cursor works for a single Table only.
Example:
curs.ImportText( fileToImport, chr(09), chr(13) )
VCursor.ExportText()
Declaration:
ExportText( inFile as FolderItem, inFieldDelimiter as String = chr(09), inLineDelimiter as String = LE, inEncoding as String = "UTF-16", inHasColumHeader as Boolean = FALSE )
Parameters:
- inFile - The file to be imported.
- inFieldDelimiter - The character to be used as a field delimeter, default is TAB chr(0x09).
- inLineDelimiter - The character to be used as a record delimeter, default is the OS Line Ending.
- inEncoding - Encoding of the imported file.
- inHasColumHeader - TRUE if import file has colum header line.
Description:
This command exports the fields and records of a Cursor to the designated text file. Using the SELECT statement, you can define the fields to export and their order, as well as the records to be exported.
Example:
curs.ExportText( fileToExport, chr(09), chr(13) )