Importing/Exporting Variables from/to a .csv File
This topic contains the following sections:
Exporting variables to a csv file
To export the declarations of the active variables grid to a .csv file, click the button on the toolbar. Alternatively, select 'Export CSV...' from the context menu.
All declarations are written to the export file independent of any selection in the grid.
Note
If you edit the exported csv file with an external tool, you must make sure that the editor used does not change the column separators (semicolons) or the file encoding. For example, MS Excel may be set to modify csv files so that they cannot be reimported. |
Importing variables from a csv file
To import declarations from a .csv file, click the button on the toolbar. Alternatively, select 'Import CSV...' from the context menu.
In the file open dialog, select the .csv file you want to import and click 'Open'.
- Existing variables are not overwritten or modified. Instead, all variables contained in the csv file are imported into the grid even if they already exist. As a result, multiple identical variable names may exist and cause errors. If you have edited an existing set of variables using an external tool, you have to remove them from the grid prior to starting the import.
- New variables are added at the end of the group which is specified at the beginning of each line in the csv file. (New groups are added at the end of the grid, if necessary.)
- For newly added variables, the 'Access' property is set to 'Private'. You can edit this property in the grid after the import.
- Variables with invalid properties, for example, invalid data types are imported but marked as erroneous in the grid (in addition, a corresponding entry is shown in the error list). The same applies to declarations with properties that must not be combined.
- After importing variables into the variables grid of a safety-related POU, you have to verify that the import has been completed without any data modification/corruption. This applies in particular to safety-related variables.
It is possible to import standard data types into a safety-related POU and vice versa.
Keep in mind that safety-related data types in a standard POU cause a CIL Generator error when building the project. - Variables with invalid names are not imported.
The process, however, is not aborted and all valid variables are imported.
Whitespaces at the beginning of the variable name are ignored. - The import process is logged in the 'Project Log' (MESSAGES window).