Cicode Programming Reference > Cicode Function Categories > Trend Functions | Cicode

Trend Functions

You can control a trend's operation by using the trend functions. Citect SCADA has standard trend pages, so you would not normally use these low-level functions unless you want to define your own trend displays. You can control the movement of the trend cursor, trend scaling, and the definition of trend attributes (such as the trend starting time and sampling period). You can also create, and subsequently delete trends.

Following are functions relating to Trends:

TrnAddHistory

Restores an old history file to the trend system.

TrnBrowseClose

Closes a trend browse session.

TrnBrowseFirst

Gets the oldest trend entry.

TrnBrowseGetField

Gets the field indicated by the cursor position in the browse session.

TrnBrowseNext

Gets the next trend entry in the browse session.

TrnBrowseNumRecords

Returns the number of records in the current browse session.

TrnBrowseOpen

Opens a trend browse session.

TrnBrowsePrev

Gets the previous trend entry in the browse session.

TrnClientInfo

Gets information about the trend that is being displayed at the AN point.

TrnComparePlot

Prints two trends (one overlaid on the other), each with up to four trend tags.

TrnDelete

Deletes a trend created by the TrnNew() function.

TrnDelHistory

Deletes an old history file from the trend system.

TrnEcho

Enables and disables the echo on the trend display.

TrnEventGetTable

Stores event trend data and the associated time stamp in an event table and time table, for a specified trend tag.

TrnEventGetTableMS

Stores event trend data and time data (including milliseconds) for a specified trend tag.

TrnEventSetTable

Sets trend data from a table, for a specified trend tag.

TrnEventSetTableMS

Sets event trend data and time data (including milliseconds) for a specified trend tag.

TrnExportClip

Exports trend data to the clipboard.

TrnExportCSV

Exports trend data to a file in CSV (comma separated values) format.

TrnExportDBF

Exports trend data to a file in dBASE III format.

TrnExportDDE

Exports trend data to applications via DDE.

TrnFlush

Flushes the trend to disk.

TrnGetBufEvent

Gets the event number of a trend at an offset for a pen.

TrnGetBufTime

Gets the trend time at an offset for a pen.

TrnGetBufValue

Gets the trend value at an offset for a pen.

TrnGetCluster

Gets the name of the cluster the trend graph is associated with.

TrnGetCursorEvent

Gets the event number of a trend at the trend cursor.

TrnGetCursorMSTime

Gets the time (in milliseconds from the previous midnight) at a trend cursor for a specified pen.

TrnGetCursorPos

Gets the position of the trend cursor.

TrnGetCursorTime

Gets the time/date at the trend cursor.

TrnGetCursorValue

Gets the current trend cursor value of a pen.

TrnGetCursorValueStr

Gets the current trend cursor value of a pen as a formatted string.

TrnGetDefScale

Gets the default engineering zero and full scales of a trend tag.

TrnGetDisplayMode

Gets the display mode of a trend.

TrnGetEvent

Gets the event number of a trend at a percentage along the trend.

TrnGetFormat

Gets the format of a pen.

TrnGetGatedValue

Returns the internally stored value for <GATED>.

TrnGetInvalidValue

Returns the internally stored value for <TRN_NO_VALUES>.

TrnGetMode

Gets the display mode of trends (historical or real-time).

TrnGetMSTime

Gets the time (in milliseconds from the previous midnight) of the trend (plotted by a specified pen)
at a percentage along the trend,using the time and date of the latest sample displayed.

TrnGetPen

Gets the trend tag of a pen.

TrnGetPenComment

Gets the comment of a trend pen.

TrnGetPenFocus

Gets the number of the pen currently in focus.

TrnGetPenNo

Gets the pen number of a pen name.

TrnGetPeriod

Gets the display period of a trend.

TrnGetScale

Gets the scale of a pen.

TrnGetScaleStr

Gets the scale of a pen as a formatted string.

TrnGetSpan

Gets the span time of a trend.

TrnGetTable

Stores trend data in an array.

TrnGetTime

Gets the time/date of a pen.

TrnGetUnits

Gets the data units of a trend pen.

TrnInfo

Gets the configured values of a trend tag.

TrnIsValidValue

Determines whether a logged trend value is <VALID>, <GATED>, or invalid <TRN_NO_VALUES>.

TrnNew

Creates a new trend at run time.

TrnPlot

Prints a plot of one or more trend tags.

TrnPrint

Prints a trend that is displayed on the screen.

TrnSamplesConfigured

Gets the number of samples configured for the currently displayed trend.

TrnScroll

Scrolls a trend pen.

TrnSelect

Sets up a page for a trend.

TrnSetCursor

Moves the trend cursor a specified number of samples.

TrnSetCursorPos

Moves the trend cursor to the given x-axis position.

TrnSetDisplayMode

Specifies how trend samples will be displayed on the screen.

TrnSetEvent

Sets the start event of a trend pen.

TrnSetPen

Sets a trend pen to a new trend tag.

TrnSetPenFocus

Sets the pen focus.

TrnSetPeriod

Sets the display period (time base) of a trend.

TrnSetScale

Re-scales a pen.

TrnSetSpan

Sets the span time of a trend.

TrnSetTable

Sets trend data from an array.

TrnSetTime

Sets the starting time/date of a pen.

The following trend functions are used on standard trend templates. Use these functions only if you create your own trend templates
(These functions are written in Cicode and can be found in the include project.)

TrendDspCursorComment

Displays the Trend Comment for the currently selected pen.

TrendDspCursorScale

Displays a scale value for the current pen.

TrendDspCursorTag

Displays the tag name of the current pen.

TrendDspCursorTime

Displays the cursor time of the current pen.

TrendDspCursorValue

Displays the cursor value of the current pen.

TrendGetAn

Gets the AN number of the trend under the mouse position.

TrendPopUp

Displays a pop-up trend with the specified trend pens.

TrendRun

Initializes the cursor and rubber-band features on a trend page.

TrendSetDate

Sets the starting date for the pens on a trend.

TrendSetScale

Sets the scale of one or more pens on a trend.

TrendSetSpan

Sets the span time of a trend.

TrendSetTime

Sets the starting time for the pens on a trend.

TrendSetTimebase

Sets a new sampling period for a trend.

TrendWin

Displays a trend page (in a new window) with the specified trend pens.

TrendZoom

Zooms a trend in either one or both axes.

See Also

Published June 2018