Applies To:
  • CitectSCADA 5.50, 6.00
  • CitectHMI 5.50, 6.00

CitectSCADA/HMI allows trend tag names to be up to 31 characters long (79 characters in v6.00). However, exporting trends to a CSV file with the TrnExportCSV() function fails if the total length of the time, date, and all trend tags would exceed 256 characters. Depending on the Citect version, either the names are truncated or the last few trend tags are not exported. 

This can be fixed by modifying the file in the Include project. The following code can be used to remove the limitation for the export of periodic trends in Citect 5.50 and 6.00. It would be necessary to adapt it to work with previous releases or other export types.

Note: Modifying the Include project is not recommended unless it is necessary. Installing Citect service packs or releases may overwrite the Include project files, so it will be necessary to redo any changes. The Include project is not backed up when you back up your project. Please make a copy of any files that you modify in case the changes do not work as expected.

1. Open in the Include project
2. Find the _TrnPeriodicExportCSV() function definition and delete the entire function. Be careful not to delete any other functions
3. Paste the following code in place of the original _TrnPeriodicExportCSV() function
4. Save and close
5. Select your project in the Citect Explorer
6. Do a full compile (in the Project Editor | Tools menu | Options, turn off Incremental Compile, then compile the project)

You should now be able to export up to 8 periodic trends to a CSV file regardless of the trend tag name length. This applies to the Save button on the trend templates as well as calling the TrnExportCSV() function.

This function also adds a new export mode for TrnExportCSV():

Padding   0  Pad data with spaces to fill the entire field width (default)
		32 Disable padding 

Disabling padding dramatically reduces the CSV file size, especially if long trend tag names are used.