Jump to content

Component: CSV Read/Write (File): Difference between revisions

From Flowcode Help
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable""
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(2 intermediate revisions by the same user not shown)
Line 77: Line 77:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AddInteger'''
| width="90%" class="mtx-class-macrohead" | '''AddInteger'''
|-
|-
| colspan="2" | Adds an integer number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
| colspan="2" | Adds an integer number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
Line 96: Line 96:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AddNumber'''
| width="90%" class="mtx-class-macrohead" | '''AddNumber'''
|-
|-
| colspan="2" | Adds a number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
| colspan="2" | Adds a number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
Line 115: Line 115:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AddString'''
| width="90%" class="mtx-class-macrohead" | '''AddString'''
|-
|-
| colspan="2" | Adds a string to the CSV followed by a comma. This will form a single column of data in the CSV file. 
| colspan="2" | Adds a string to the CSV followed by a comma. This will form a single column of data in the CSV file. 
Line 134: Line 134:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CloseFile'''
| width="90%" class="mtx-class-macrohead" | '''CloseFile'''
|-
|-
| colspan="2" | Closes the file and finishes off any pending writes ready for use in an external application. 
| colspan="2" | Closes the file and finishes off any pending writes ready for use in an external application. 
Line 148: Line 148:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''NextRow'''
| width="90%" class="mtx-class-macrohead" | '''NextRow'''
|-
|-
| colspan="2" | Move to the next row in the file 
| colspan="2" | Move to the next row in the file 
Line 162: Line 162:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OpenFile'''
| width="90%" class="mtx-class-macrohead" | '''OpenFile'''
|-
|-
| colspan="2" | Creates or opens a file ready for streaming data. If the file already exists then the contents will be deleted and the file started again from scratch. Returns 1 if file found and opened. 
| colspan="2" | Creates or opens a file ready for streaming data. If the file already exists then the contents will be deleted and the file started again from scratch. Returns 1 if file found and opened. 
Line 186: Line 186:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAsNumber'''
| width="90%" class="mtx-class-macrohead" | '''ReadAsNumber'''
|-
|-
| colspan="2" | Reads the contents of a cell as a number. 
| colspan="2" | Reads the contents of a cell as a number. 
Line 210: Line 210:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadAsString'''
| width="90%" class="mtx-class-macrohead" | '''ReadAsString'''
|-
|-
| colspan="2" | Reads the contents of a cell as a string 
| colspan="2" | Reads the contents of a cell as a string 
Line 234: Line 234:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SequentialReadNumber'''
| width="90%" class="mtx-class-macrohead" | '''SequentialReadNumber'''
|-
|-
| colspan="2" | Reads the contents of a cell as a number. Automatically moved to the next data cell after a read. 
| colspan="2" | Reads the contents of a cell as a number. Automatically moved to the next data cell after a read. 
Line 248: Line 248:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SequentialReadString'''
| width="90%" class="mtx-class-macrohead" | '''SequentialReadString'''
|-
|-
| colspan="2" | Reads the contents of a cell as a string. Automatically moved to the next data cell after a read. 
| colspan="2" | Reads the contents of a cell as a string. Automatically moved to the next data cell after a read. 
Line 262: Line 262:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetSequentialIndex'''
| width="90%" class="mtx-class-macrohead" | '''SetSequentialIndex'''
|-
|-
| colspan="2" | Sets the index for sequential reads. Index is automatically reset to 0 after a file open. 
| colspan="2" | Sets the index for sequential reads. Index is automatically reset to 0 after a file open. 
Line 282: Line 282:
{| class="mtx-class-macrotable wikitable"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Latest revision as of 14:23, 13 July 2026

Author Matrix TSL
Version 1.0
Category File


CSV Read/Write component

A component to simplify the task of creating and dumping data to a CSV file that can be loaded into Microcoft Excel or LibreOffice Math to create nice charts and graphs. Requires one of the File components to provide access to the file system.

Detailed description

No detailed description exists yet for this component

Examples

Simple example file to generate a two column CSV file that can be loaded into Microsoft Excel or LibreOffice Math.

The CSV Read/Write component is for simulation or App Developer.

For an embedded CSV read write see the File component

CSV Component used with App Developer -> File component: CSV Test AD


The component requires linking to a File component to provide access to the file system for simulation and runtime, this could be the File SD, File RPI or File AppDeveloper components.


Macro reference

AddInteger

AddInteger
Adds an integer number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
- LONG data
 
- VOID Return


AddNumber

AddNumber
Adds a number to the CSV followed by a comma. This will form a single column of data in the CSV file. 
- FLOAT data
 
- VOID Return


AddString

AddString
Adds a string to the CSV followed by a comma. This will form a single column of data in the CSV file. 
- STRING data
 
- VOID Return


CloseFile

CloseFile
Closes the file and finishes off any pending writes ready for use in an external application. 
- VOID Return


NextRow

NextRow
Move to the next row in the file 
- VOID Return


OpenFile

OpenFile
Creates or opens a file ready for streaming data. If the file already exists then the contents will be deleted and the file started again from scratch. Returns 1 if file found and opened. 
- STRING Filename
 
- BOOL Erase
0=Append existing data, 1=Reset file data 
- BOOL Return


ReadAsNumber

ReadAsNumber
Reads the contents of a cell as a number. 
- UINT Column
 
- UINT Row
 
- FLOAT Return


ReadAsString

ReadAsString
Reads the contents of a cell as a string 
- UINT Column
 
- UINT Row
 
- STRING Return


SequentialReadNumber

SequentialReadNumber
Reads the contents of a cell as a number. Automatically moved to the next data cell after a read. 
- FLOAT Return


SequentialReadString

SequentialReadString
Reads the contents of a cell as a string. Automatically moved to the next data cell after a read. 
- STRING Return


SetSequentialIndex

SetSequentialIndex
Sets the index for sequential reads. Index is automatically reset to 0 after a file open. 
- UINT Index
 
- VOID Return


Property reference

Properties
LinkTo
 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_CSV_Writer.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_CSV_Writer.fcfx