Description
This function parses CSV files into OpenInsight delimited data.
Syntax
data = RTI_ParseCSV( inData, skipFlag [, filePath, startRow, endRow] )
Parameters
The function has the following parameters:
Parameter | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
inData | An opened CSV file. If the filePath parameter is provide the inData variable is ignored. | ||||||||
skipFlag | When parsing the data, the first line may be skipped.
| ||||||||
filePath | (Optional) The full path and name of the CSV file to be imported. if this parameter is provided then the inData parameter is ignored. | ||||||||
startRow | (Optional) The starting row to be parsed within the CSV file. | ||||||||
endRow | (Optional) The ending row to be parsed within the CSV file. |
Returns
The CSV data is returned as @vm delimited data within @fm delimited rows.
Remarks
A Get_Status() call after the execution of the function will return an error code if the file passed in the filePath parameter encounters an error.
See also
Example 1
* Parse an open CSV file skipFlag = 1 ; * skip the first line of the CSV data when parsing OsRead inData from csvFile then data = RTI_ParseCSV( inData, skipFlag ) end
Example 2
* Parse an open CSV, returning rows 25 through 60 skipFlag = 1 ; * skip the first line of the CSV data when parsing filePath = "" startRow = 25 endRow = 60 OsRead inData from csvFile then data = RTI_ParseCSV( inData, skipFlag, filePath, startRow, endRow ) end
Example 3
* Parse a CSV file, passing the filePath to the function skipFlag = 1 filePath = "C:\some_csv_file.csv" startRow = "" endRow = "" Set_Status(0) data = RTI_ParseCSV( inData, skipFlag, filePath, startRow, endRow ) if data = "" then error = Get_Status(errCodes) if errCodes then FsMsg(errCodes) end end
Example 4
* Parse a CSV file, passing the filePath to the function. * Parse from row 10 forward skipFlag = 1 filePath = "C:\some_csv_file.csv" startRow = 10 endRow = "" Set_Status(0) data = RTI_ParseCSV( inData, skipFlag, filePath, startRow, endRow ) if data = "" then error = Get_Status(errCodes) if errCodes then FsMsg(errCodes) end end
Example 5
* Parse a CSV file, passing the filePath to the function. * Parse through row 10 skipFlag = 1 filePath = "C:\some_csv_file.csv" startRow = "" endRow = 10 Set_Status(0) data = RTI_ParseCSV( inData, skipFlag, filePath, startRow, endRow ) if data = "" then error = Get_Status(errCodes) if errCodes then FsMsg(errCodes) end end