Applies To:
  • CitectSCADA 5.xx, 6.xx, 7.00
  • CitectHMI 5.xx, 6.xx, 7.00

Summary:
When I add the iDisplayMode1 ... iDisplayMode8 parameters to the TrnExportCSV() cicode function, I get an Error code 289. If I remove these parameters however, the function works fine. Why is this?
 

Solution:
The TrnExportCSV() function can export trend samples for up to 8 tags. Now, just because it can do up to 8 tags doesn't mean that you have to export data for 8 tags. For example, if you wanted to export data from 1 trend tag called 'TrendTag1', you could call the TrnExportCSV() function as shown below:

TrnExportCSV("C:\TrendTag1.csv", TimeCurrent(), 2, 10, 1, "TrendTag1")

Notice that nothing was passed in for the iDisplayMode1 ... iDisplayMode8 parameters. By omitting these, you are telling the TrnExportCSV() function to use the default mode of 3. Now, if you were to change your mind and wanted to use display mode 2 instead of the default, how would you do this? It is common for one to think that the syntax below is correct:

TrnExportCSV("C:\TrendTag1.csv", TimeCurrent(), 2, 10, 1, "TrendTag1", 2)

Unfortunately, this is not correct because the iDisplayMode1 ... iDisplayMode8 parameters must come after all the sTag parameters. In the case where you are exporting samples for just the 1 trend tag, you would need to pass in blank values for the remaining sTag2 ... sTag8 parameters, before you can set the iDisplayMode parameters. Below is an example of this:

TrnExportCSV("C:\TrendTag1.csv", TimeCurrent(), 2, 10, 1, "TrendTag1", "", "", "", "", "", "", "", 2)

The TrnExportCSV() function is located in the export.ci file in the 'Include' project. For a better understanding of how this function works, please refer to this file.

 

Keywords:
TrnExportCSV, Parameters, Cicode Error 289  

Attachments