Cicode Programming Reference > Cicode Function Categories > Trend Functions Introduction > TrnAddHistory

TrnAddHistory

Adds an old (backed up) trend history file to the trend system so that its data can be used. When you back-up a trend file, change its extension so that it indicates the age of the file's trend data (for example, the month and year).

An archived trend file does not need to reside in the same directory as existing active trends. CitectSCADA retrieves the trend name from the header of the specified file and adds its data to the trend history. Please be aware that only a reference to the archived file, and not the file itself, is kept in the trend history. Therefore, care needs to be taken if using this function to access archived files residing on removable storage media. When you remove the media, the archived data is no longer available for display.

This function can only be used if the Trend Server is on the current machine. When the Trend Server is not in the calling process, this function will become blocking and cannot be called from a foreground task. In this case, the return value will be undefined and a Cicode hardware alarm will be raised.

Syntax

TrnAddHistory(FileName [, ClusterName] )

FileName:

The file name and directory path of an old history file. The old file does not need to reside in the same directory as existing active trends to be restored.

ClusterName:

Specifies the name of the cluster in which the Trend Server resides. This is optional if you have one cluster or are resolving the trend server via the current cluster context. The argument is enclosed in quotation marks "".

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

TrnDelHistory, MsgRPC

Example

TrnAddHistory("C:\CITECT\DATA\TR1.MAY91");
! Adds the file TR1.MAY91 to the trend system.

See Also

Trend Functions