ihComments Table
The ihComments table contains the annotations associated with the collected data. There is a separate row of data in the ihComments table for each comment associated with a tag. For instance, you can have five rows that contain the same tag and timestamp, but each contain a different comment value.
It is possible to have different data types of annotations. Comments are most often strings, but can be binary numbers or BLOBs. Only string comments are returned in the ihComments table.
The following table describes the columns of the ihComments table.Column Name | Data Type | Description |
---|---|---|
Tagname | VT_BSTR | Tagname property of the tag. Note: There is no length limit for Historian tag names in the Data Archiver. However, different client applications may have their own limits. |
TimeStamp | VT_DBTimeStamp | The date and time that the data was generated. |
TimeStampSeconds | VT_DBTimeStamp | The date and time that the data was generated. |
Microseconds | VT_I4 | The microsecond portion of the date and time. |
StoredOnTimeStamp | VT_DBTimeStamp | The date and time that the comment was generated. |
StoredOnTimeStamp | VT_DBTimeStamp | The time that the comment was added to the archive. |
SuppliedUsername | VT_BSTR | The username of the currently logged-in Windows user at the time that the comment was entered. |
Username | VT_BSTR | Username provided along with the comment. |
Comment | VT_BSTR | The actual comment. |
DataTypeHint | VT_BSTR | Name of the data type for the comment:
|
SamplingMode | VT_BSTR | The mode used to sample data from the archive:
|
Direction | VT_BSTR | The direction (forward or backward from the start time) of data sampling from the archive. |
NumberOfSamples | VT_I4 | Number of samples from the archive to retrieve. Samples will be evenly spaced within the time range defined by start and end times for most sampling modes. For the Note: The NumberofSamples and IntervalMilliseconds columns are mutually exclusive. If NumberofSamples is used, IntervalMilliseconds is not used. |
IntervalMilliseconds | VT_I4 | For non-raw sampled data, this column represents a positive integer for the time interval (in milliseconds) between returned samples. Note: The NumberofSamples and IntervalMilliseconds columns are mutually exclusive. If NumberofSamples is used, IntervalMilliseconds is not used. |
CalculationMode | VT_BSTR | The calculation mode, if used. |
FilterTag | VT_BSTR | Tagname used to define the filter, if specified. Only a single tag can be specified, and wildcards are not supported. |
FilterMode | VT_BSTR | The type of time filter:
The AfterTime indicates that the filter condition should be True starting at the timestamp of the archive value that triggered the True condition and ending at the timestamp of the archive value that triggered the False condition. |
FilterComparisonMode | VT_BSTR | The type of comparison to be made on the filter comparison value:
FilterTag values should be compared to FilterValue values to establish the state of the filter condition. If FilterTag and FilterComparisonValue values are specified, time periods are filtered from the results where the filter condition is False . |
FilterValue | VT_BSTR | The value with which to compare the FilterTag value to determine appropriate filter times. |
FilterExpression | VT_BSTR | An expression which includes one or more filter conditions. The type of conditions used are:
FilterTag , FilterComparisonMode , and FilterValue columns. While using FilterExpression , the expression is passed within single quotes, and for complex expressions you write the conditions within parentheses. There is no maximum length for FilterExpression , but if called using OLE DB or Excel, these tools may have their own limitations. |
TimeZone | VT_BSTR | The type of time zone used:
|
DaylightSavingTime | VT_BOOL | Indicates whether Daylight Saving Time logic should be applied to timestamps. |
RowCount | VT_I4 | Indicates the maximum number of rows that can be returned. A value of 0 indicates that there is no limit to the number of rows returned. |
ihComments Examples
Example SQL statements for the ihComments table are outlined in the following examples.
Example 1: Retrieve All Comments for a Specific Tag for This Month
SELECT * FROM ihcomments WHERE tagname LIKE '*001'
AND timestamp>bom
Example 2: Retrieve Comments That Contain a Substring
SELECT * FROM ihcomments WHERE comment LIKE '*abc*'
Example 3: Retrieve All Comments in an Archive
SELECT * FROM ihComments WHERE timestamp<=Now
AND samplingmode=rawbytime