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


Adds new event to a trend, or overwrites existing points with new values.

To add new events, set 'EventNo' to zero. The events are inserted at a point determined by the time stamp associated with each event. If the timestamp of a new event is identical to that of an existing event, the new event will overwrite the old one.

To overwrite specific existing events, set 'EventNum' to the last event number of the block of events to be overwritten, and set the times of the new events to zero.

This function is a blocking function. It blocks the calling Cicode task until the operation is complete.


TrnEventSetTable(Tag, EventNo, 0, Length, Table, TimeTable [, ClusterName] )


The trend tag enclosed in quotation marks "" (can be prefixed by the name of the cluster that is ClusterName.Tag).


Event Number:


The number of trend values in the trend table.


The table of floating-point values in which the trend data is stored. You can enter the name of an array here (see the example).


The table of integer values in which the time stamp is stored. If you would like events to stay in correct time-stamp order, sort the values in this table in ascending order. When EventNo is non-zero the values in this table may be zero. This will result in the values of the requested events being overwritten but the time-stamps staying the same.


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

Return Value

The actual number of samples written. The return value is 0 if an error is detected. You can call the IsError() function to get the actual error code.

Related Functions




REAL TrendTable1[100];
INT TimeTable[100];
/* Defines an array of a maximum of 100 entries. Assume that TrendTable1 has been storing data from a source. */
TrnEventSetTable("OP1",nEventNo, 1,10,TrendTable1[0], TimeTable[0], "ClusterXYZ");
/* A set of 10 trend data values are set for the OP1 trend tag. */

See Also

Trend Functions