HistorianWriteRecords

(Engine-Level Function)

Description Writes records to the data store identified by the ConnectionHandle
Warning

This function should be used only by advanced programmers.

The function WriteHistory is recommended for most uses.

Returns A counter value, or Invalid if parameters are invalid
Usage Script Only.
Threaded Yes
Related to: HistorianConnect | HistorianDeleteRecords | HistorianGetData | HistorianGetInfo | HistorianReadRecords
Format HistorianWriteRecords (ConnectionHandle, TagName, Schema, Records, SequenceID)
Parameters  
ConnectionHandle
As returned by an HistorianConnect call.
TagName
A text string representing the desired table name. Engine code may modify this to conform with storage limitations.
Schema
This is a textual representation of a schema structure.
Records
Array of data. This is a single dimension array representing the Fields (columns) to be written. Each entry in this array may be either a single data value or an array of values. If any entry is an array, then the size of the largest array gives the number of records (rows) to be written. If any individual field is underspecified, then a representation of INVALID is written for the missing values.
SequenceID
A 12-byte, binary token.
Comments Data is always appended to the data store, and records are not deleted or replaced unless HistorianDeleteRecords is called explicitly.
The function returns the counter value for the last record being written.

Note: At the point that the function returns, the data has not yet been written. Because the Counter is the actual record number (FileDB) or an index (SQL) the counter value returned here will be a calculated value, based on the number of records that are pending.

As well as defining the column format, the Schema defines the subset of tables to which the supplied data will be written.

While considered to be threaded, this function has no lifetime after it passes the records to another thread for writing.

Each record will be represented by a Counter value which is one greater than the previous Counter value, unless either Schema or MID-S have changed from the previous write. In this case, a new table/file set is started. The counter value for a new table always starts from 1.

Example:

No example provided. This function is not recommended for most use.