Applies To:
  • CitectSCADA 5.xx

The button on the top right hand corner of my trend template allows me to select new trends from either trend tag or trend tag comments. If I have comments selected how can I also display the comment instead of the tag name on the page? My comments are more descriptive than my tag names. 


All predefined trend templates are contained in the include project. Also, Cicode in the include project is used to display the currently selected pen on the trend templates. As it is bad practice to modify the include project a new, local, trend template will have to be created.

Steps to implement comment display functionality on trend pages;

1. Create a new template in your project (eg. "NTrend1" in the "Test" library). Base it on one of the templates from the include project. For this article I will use the singletrend template.

2. When you double click on a trend page a form pops up which enables the selection of 8 pens for the page from trend.dbf. To get this functionality for your template, do as follows:-

- Open the file "\citect\user\include\standard.frm"

- Copy the 8 entries (types VGA, SVGA, XGA, SXGA both with and without title bar) for the singletrend template to a new file. Replace the word singletrend with your new template's name. (In this example "NTrend1").

- Save this file in your project directory as a file of type .frm. Name it after the library in which the template lives. (In this example Test.frm)

An example of how test.frm will look is as follows. This is the XGA entry with title bar.

! Single Trend template on XGA (with title)
FORM "NTrend1@XGA", "Single Trend";
1: "Trend1_Pen1", 32, readwrite, "Trend Tags", "NAME";
2: "Trend1_Pen2", 32, readwrite, "Trend Tags", "NAME";
3: "Trend1_Pen3", 32, readwrite, "Trend Tags", "NAME";
4: "Trend1_Pen4", 32, readwrite, "Trend Tags", "NAME";
5: "Trend1_Pen5", 32, readwrite, "Trend Tags", "NAME";
6: "Trend1_Pen6", 32, readwrite, "Trend Tags", "NAME";
7: "Trend1_Pen7", 32, readwrite, "Trend Tags", "NAME";
8: "Trend1_Pen8", 32, readwrite, "Trend Tags", "NAME";

Pen 1 {1 } Pen 2 {2 }
Pen 3 {3 } Pen 4 {4 }
Pen 5 {5 } Pen 6 {6 }
Pen 7 {7 } Pen 8 {8 }

3. Open a new cicode file. Save it with a unique name (I have used

4. Add the following functions

String sMode = "0"
Function _TrnMode();
sMode=ParameterGet("Trend", "TrendPenSelect", "0")


Function TrendDspCursorTD(INT hTrendAN)
String sTemp;

IF sMode = "1" THEN
sTemp = _TrendPenNameGet(hTrendAN, 0);
_TrendDspPenStr(hTrendAN, _FindCommentFromPen(sTemp));
_TrendDspPenStr(hTrendAN, TrnGetPen(hTrendAN, 0));
return 0;

5. Modify the new template as follows;

-Add a cicode object with the following function IF PageInfo(7)="1" THEN _TrnMode(); END; (This will set the variable of sMode on page entry)

- In the top right hand corner there is a button which allows you to add/remove pens from either tag or comment. At present the button's input field is

TrendSelectPen(30); Change this to TrendSelectPen(30);_TrnMode(); (This allows us to determine whether the modehas been changed each time the form is closed)

- The cicode object which displays the tag name has the following cicode TrendDspCursorTag(30);. Change this to be TrendDspCursorTD(30); This will now call your cicode function which will display either the tag name or the tag comment depending on the state of sMode.

When you create a new page, select your template from your "test" library and continue as always. Descriptions should now be available in run mode.

Update Note: TrendDspCursorComment(iAn) supersedes this from Citect Version 5.40 onwards