Timestamp and Qualities Parameters

The Timestamp and Qualities parameters are optional.

Timestamp

The Timestamp parameter takes an absolute time value enclosed within two quotes ("). This value must be a timestamp in the past, for example: "24/12/20042:32:15 PM".

Quality

The Quality parameter takes an integer value from 0 to 100 (0 being bad quality, 100 being good quality).

Errs is an output variable, which receives an array of status codes, one for each tag written to. The following table describes the status codes.

Error CodeStringDescription
0ihSTATUS_OKThe values were successfully written to the tags.
-1ihSTATUS_FAILEDThe operation failed.
-2ihSTATUS_API_ TIMEOUTThe operation timed out while connecting to Historian.
-3ihSTATUS_NOT_ CONNECTEDThe Calculation Collector could not connect to the Historian archive.
-4ihSTATUS_INTERFACE_ NOT_FOUNDThe collector could not be contacted or connected to.
-5ihSTATUS_NOT_ SUPPORTEDThe write operation was not supported.
-6ihSTATUS_DUPLICATE_ DATAThe write operation would have created duplicate data in the archive.
-7ihSTATUS_NOT_VALID_ USERThe user name used to connect to the Historian archive is not valid.
-8ihSTATUS_ACCESS_ DENIEDThe user name used to connect to the Historian archive does not have write access to the Historian archive.
-9ihSTATUS_WRITE_IN_ FUTUREThe timestamp supplied with the function call is set to a time in the future.
-10ihSTATUS_WRITE_ ARCH_OFFLINEThe Historian archive is currently offline.
-11ihSTATUS_ARCH_ READONLYThe Historian archive is set to read-only.
-12ihSTATUS_WRITE_ OUTSIDE_ACTIVEAn attempt was made to write data to a time before the archive was created.
-13ihSTATUS_WRITE_NO_ ARCH_AVAILNo Historian archive is available for writing.
-14ihSTATUS_INVALID_ TAGNAMEThe tag name or tag names supplied do not exist in the Historian archive.
-15ihSTATUS_LIC_TOO_MANY_TAGSThe function has attempted to add more tags than the current license allows.
-16ihSTATUS_LIC_TOO_ MANY_USERSThere are currently too many users connected to the Historian archive.
-17ihSTATUS_LIC_ INVALID_LIC_DLLThe Historian license is expired or invalid.
-18ihSTATUS_NO_VALUENo value was supplied for the tag.
-19ihSTATUS_DUPLICATE_ INTERFACETwo collectors exist with the same name.
-20ihSTATUS_NOT_ LICENSEDThe Historian license is not installed.
-21ihSTATUS_CALC_CIRC_ REFERENCEA circular reference has been entered in the Calculation formula.
-22ihSTATUS_BACKUP_ EXCEEDED_SPACEThe Historian archive being written to has reached the Minimum Hard Drive Space setting, and no new archives are being created.
-23ihSTATUS_INVALID_ SERVER_VERSIONThe Historian archive being written to is not compatible with the calculation collector.
-24ihSTATUS_DATA_ RETRIEVAL_COUNT_ EXCEEDEDIndicates there were too many data points to retrieve.

Examples

The following examples show sample usage of the AddData function.

Simple data write
This example writes a single value, the current time, and a good quality value to a single tag.
errs = AddData("Bucket Brigade.UInt4", 9, "Now", 100)
Writing array data
This example uses arrays to write several values to several tags.
Dim Tags(3)
Tags(0) = "Bucket Brigade.Boolean" 
Tags(1) = "Bucket Brigade.Int4" 
Tags(2) = "Bucket Brigade.Real8" 
Tags(3) = "Bucket Brigade.String"

Dim Values(3) 
Values(0) = True 
Values(1) = 5
Values(2) = 172.3
Values(3) = "Hello, World"
errs = AddData(Tags, Values, Null, Null)
Writing timestamps and qualities
This extends the previous example, including time stamps and qualities for the values.
Dim Tags(3)
Tags(0) = "Bucket Brigade.Boolean" 
Tags(1) = "Bucket Brigade.Int4" 
Tags(2) = "Bucket Brigade.Real8" 
Tags(3) = "Bucket Brigade.String"

Dim Values(3) 
Values(0) = True 
Values(1) = 5
Values(2) = 172.3
Values(3) = "Hello, World"

Dim Timestamps(3) 
Timestamps(0) = "Today" 
Timestamps(1) = "Now" 
Timestamps(2) = "Yesterday"
Timestamps(3) = "24/12/2004 2:32:15 PM"

Dim Qualities(3) 
Qualities(0) = 100
Qualities(1) = 0
Qualities(2) = 100
Qualities(3) = 0

Dim errs

errs = AddData(Tags, Values, Timestamps, Qualities)