Write data to a CSV text file
Task:
We should create another ASCII file with different structure in the CSV format.
Requirements:
- TCP Logger and TCP Data Logger AX Professional, Enterprise, or a trial version;
- DDE Server, Local database
It is assumed that:
You've prepared parser items for export.
For this tutorial, all items were prepared in the previous part.
Also, you may read other examples of data parsing (different parser types)
Solution:
All parser items are ready for export. Now we should configure the Local database plugin. This process is straightforward. Please, open the configuration window of the Local database plugin (fig. 2) by selecting the module in the list and clicking the "Setup" button on the "Data export" tab (fig. 1).
Fig.1. Local Database plugin.
Fig.2. CSV export. Selecting a database type.
You should:
- Select a database type at field #1.
- Specify a path where the plugin will create files in field #2.
- Specify a file name prefix in field #3.
- Configure parameters of your CSV file with the group of options #4. All options in this group are optional. You may use default values.
On the "Data formats" page, you can specify a data format of your data. Because all our variables are with the "string" data type, we don't need to change format options. On the "Columns order" page (fig.2), you can specify how variables will be placed in a spreadsheet. Because we need two variables only, therefore, we need to create two items on this page by clicking the "Add item" button (fig.2, pos.5).
Fig.2. CSV export. Columns order options.
Before adding an item, the program will ask you about an item description. You can type any characters here, which will help you to remember a variable's content.
Each data export item has the following properties:
- Parser item name - it is a parser variable name that we specified in the parser module. You may select a variable name from a drop-down box, which appears by clicking on a link of this property;
- Column order - it's a position of a variable in a spreadsheet. The minimum value is 1;
- Column length - it's a column width. This option is not required in our case because we are using a delimited CSV file;
- Data type - the module will use this type for formatting a value.
Please click the "OK" button and close the configuration window of the "Local database" plugin. Then click the "OK" button in the options window.
Ok. All settings had been configured, and we are now ready to capture barcodes.
Related articles: Write data to a CSV text file
- RS232 to Excel. Four methods to send data from RS232 to Excel Plugins: Various
- Write data to an XLS file without Microsoft Excel installed Plugins: Local database
- Send data to Excel through the DDE interface Plugins: DDE Server
- Export data and charting in Excel in real-time Plugins: Direct Excel Connection
- Write data to a CSV text file Plugins: Local database, DDE Server
- Export real-time data and charting in OpenOffice or LibreOffice Calc Plugins: Direct OpenOffice/LibreOffice Connection
- Write data to an XLS file without Excel Tags: advanced export, rich formatting, many options. Plugins: Excel Export Pro
- Write data to an XLS file without Excel Tags: variant #2. Plugins: Local database