Method Reference Q-T

Q

QueryArray Method (Archives Object)

This function returns a list of properties of an Archive found on the Historian server.

Syntax

object.QueryArray(ArchiveName, Params, SortAscending, ArrayOrientation, ArraySize, ReturnCount, ReturnArray)

Table 1. Parameters
Name Data Type Description
ArchiveName String Name of the Archive to return information on.
ParamsVariant A list of the parameters to retrieve on the specified Archive.
SortAscendingBoolean Sorting preference for the returned list of properties.
ArrayOrientationInteger The desired orientation of the returned array.
ArraySizeLong The desired size of the returned array.
ReturnCountLongThe number of rows returned in ReturnArray
ReturnArrayVariantA returned array which contains the requested properties.

Returns

Boolean. Success/Failure.

QueryArray Method (Collectors Object)

This function returns a list of properties for a set of Collectors.

Syntax

object.QueryArray(CollectorName, Params, SortAscending, ArrayOrientation, ArraySize, ReturnCount, ReturnArray)

Table 2. Parameters
Name Data Type Description
CollectorName String Name of the Collector to return information on.
ParamsVariant A list of the parameters to retrieve from the Collectors.
SortAscendingBoolean Sorting preference for the returned list of properties.
ArrayOrientationInteger The desired orientation of the returned array.
ArraySizeLong The desired size of the returned array.
ReturnCountLongThe number of rows returned in ReturnArray
ReturnArrayVariantA returned array which contains the requested properties.

Returns

Boolean. Success/Failure.

QueryArray Method (DataRecordset Object)

This function returns an array of data records from the Historian server.

Syntax

object.QueryArray(Params, SortAscending, ArrayOrientation, ArraySize, ReturnCount, ReturnArray)

Table 3. Parameters
Name Data Type Description
ParamsVariant A list of the parameters to retrieve.
SortAscendingBoolean Sorting preference for the returned list of properties.
ArrayOrientationInteger The desired orientation of the returned array.
ArraySizeLong The desired size of the returned array.
ReturnCountLongThe number of rows returned in ReturnArray
ReturnArrayVariantA returned array which contains the requested properties.

Returns

Boolean. Success/Failure.

QueryArray Method (MessageRecordset Object)

This function returns an array of Messages from the Historian server.

Syntax

object.QueryArray(Params, SortAscending, ArrayOrientation, ArraySize, ReturnCount, ReturnArray)

Table 4. Parameters
Name Data Type Description
ParamsVariant A list of the parameters to retrieve.
SortAscendingBoolean Sorting preference for the returned list of properties.
ArrayOrientationInteger The desired orientation of the returned array.
ArraySizeLong The desired size of the returned array.
ReturnCountLongThe number of rows returned in ReturnArray
ReturnArrayVariantA returned array which contains the requested properties.

Returns

Boolean. Success/Failure.

QueryArray Method (TagRecordset Object)

This function returns an array of Tags from the Historian server.

Syntax

object.QueryArray(Params, SortAscending, ArrayOrientation, ArraySize, ReturnCount, ReturnArray)

Table 5. Parameters
Name Data Type Description
Params Variant A list of the parameters to retrieve.
SortAscendingBooleanSorting preference for the returned list of properties.
ArrayOrientationIntegerThe desired orientation of the returned array.
ArraySizeLongThe desired size of the returned array.
ReturnCountLongThe number of rows returned in ReturnArray.
ReturnArrayVariantA returned array which contains the requested properties.

Returns

Boolean. Success/Failure

QueryRecordset Method (DataRecordset Object)

Executes the DataValue query based on the fields and criteria specified.

Syntax

object.QueryRecordset

Parameters

None

Returns

Boolean. Returns whether or not the QueryRecordset operation succeeded.

Example

Dim I As Integer 
Dim J As Integer 
Dim K As Integer 
Dim strComment$
Dim lngInterval As Long
Dim TagCount As Integer
Dim strDataQuality As String
Dim iDataRecordset As iHistorian_SDK.DataRecordset
Dim iDataValue As iHistorian_SDK.DataValue 
Dim lEndTime&, lStartTime&, lNumSamples& 
Dim lNumSeconds, lNumSamplesPerSecond
On Error GoTo Error_Handle
If CheckConnection = True Then
If lbTags.Text = "" Then
MsgBox "No Tag Selected", vbOKOnly, "SDK Sample" Exit Sub
End If
Set iDataRecordset = ConnectedServer.Data.NewRecordset
'reset lstValues.Clear
'build query
With iDataRecordset
'filter code
If txtFilterTag.Text <> "" Then
.Criteria.FilterTagSet = True
.Criteria.FilterTag = txtFilterTag.Text
.Criteria.FilterComparisonModeSet = True
'comparison mode
Select Case cboComparisonMode.Text
Case Is = "Equal"
.Criteria.FilterComparisonMode = 1
Case Is = "NotEqual " 
.Criteria.FilterComparisonMode = 2
Case Is = "LessThan"
.Criteria.FilterComparisonMode = 3
Case Is = "GreaterThan"
.Criteria.FilterComparisonMode = 4
Case Is = "LessThanEqual"
.Criteria.FilterComparisonMode = 5
Case Is = "GreaterThanEqual"
.Criteria.FilterComparisonMode = 6
End Select
.Criteria.FilterModeSet = True
'filter mode
Select Case cboFilterMode.Text
Case Is = "ExactTime"
.Criteria.FilterMode = 1
Case Is = "BeforeTime"
.Criteria.FilterMode = 2
Case Is = "AfterTime"
.Criteria.FilterMode = 3
Case Is = "BeforeAndAfterTime"
.Criteria.FilterMode = 4
End Select
.Criteria.FilterComparisonValue = txtFilterValue.Text
End If
.Criteria.Tagmask = lbTags.Text
.Criteria.StartTime = dtStartTime.Value
.Criteria.EndTime = dtEndTime.Value
'get sample mode
Select Case cboSampleMode.Text
Case Is = "Interpolated"
.Criteria.SamplingMode = 2 'interpolated
Case Is = "Raw By Number"
.Criteria.SamplingMode = 5 'raw by number
Case Is = "Raw By Time"
.Criteria.SamplingMode = 4 'raw by time
Case Is = "Current Value"
.Criteria.SamplingMode = 1 'current value
Case Is = "Calculated"
.Criteria.SamplingMode = 6 'calculation
Case Is = "Trend"
.Criteria.SamplingMode = 3 'trend
End Select
If .Criteria.SamplingMode = 5 Then
'if raw by number get direction
If optDirectionForward.Value = True Then
.Criteria.Direction = 1 'forward
Else
.Criteria.Direction = 2 'backward
End If
End If
'if calculation get calc mode
If .Criteria.SamplingMode = 6 Then
Select Case cboCalculationMode.Text
Case Is = "Average"
.Criteria.CalculationMode = 1 'average
Case Is = "Standard Deviation"
.Criteria.CalculationMode = 2 'standard deviation
Case Is = "Total"
.Criteria.CalculationMode = 3 'total
Case Is = "Minimum" 
.Criteria.CalculationMode = 4 'minimum
Case Is = "Maximum"
.Criteria.CalculationMode = 5 'maximum
Case Is = "Count"
.Criteria.CalculationMode = 6 'count
Case Is = "Raw Average"
.Criteria.CalculationMode = 7 'raw average
Case Is = "Raw Standard Deviation"
.Criteria.CalculationMode = 8 'raw standard deviation
Case Is = "Raw Total"
.Criteria.CalculationMode = 9 'raw total
Case Is = "Minimum Time"
.Criteria.CalculationMode = 10 'minimum time
Case Is = "Maximum Time"
.Criteria.CalculationMode = 11 'maximum time
Case Is = "Time Good"
.Criteria.CalculationMode = 12 'time good
End Select
End If
If optSamplingByNumber.Value = True Then
.Criteria.NumberOfSamples = Int(txtNumSamples.Text) Else
Select Case cboTimeUnits.Text
Case Is = "Milliseconds"
.Criteria.SamplingInterval = Int(txtInterval.Text) Case Is = "Seconds"
.Criteria.SamplingInterval = Int(txtInterval.Text) * 1000
Case Is = "Minutes"
.Criteria.SamplingInterval = Int(txtInterval.Text) * 60000
Case Is = "Hours"
.Criteria.SamplingInterval = Int(txtInterval.Text) * 3600000
Case Is = "Days"
.Criteria.SamplingInterval = Int(txtInterval.Text) * 86400000
End Select
End If
.Fields.AllFields
VB.Screen.MousePointer = vbHourglass 'wait wait wait lStartTime = Timer
'do query
If Not .QueryRecordset Then lEndTime = Timer
MsgBox "Query Failed..." & Chr(13) & iDataRecordset.LastError
VB.Screen.MousePointer = vbDefault
Exit Sub
End If
lEndTime = Timer VB.Screen.MousePointer = vbDefault lNumSamples = 0
TagCount = iDataRecordset.Item(1).Count
For I = 1 To iDataRecordset.Tags.Count
For J = 1 To iDataRecordset.Item(I).Count
Set iDataValue = iDataRecordset.Item(I).Item(J) Select Case iDataValue.DataQuality
Case Is = 1
strDataQuality = "Good" Case Is = 2
strDataQuality = "Bad" Case Is = 3
strDataQuality = "Unknown" 
Case Else
strDataQuality = "ERROR" End Select
strComment = ""
For K = 1 To iDataValue.Comments.Count
strComment = strComment & " " & iDataValue.Comments(K).Comment
Next K
lstValues.AddItem Format(iDataValue.TimeStamp, "MM/dd/yyyy hh:mm:ss") & _
Space(10) & CStr(iDataValue.Value) & vbTab & strDataQuality & vbTab & strComment lNumSamples = lNumSamples + 1
Next J 
Next I
End With
lNumSeconds = lEndTime - lStartTime lNumSamplesPerSecond = lNumSamples If lNumSeconds > 0 Then
lNumSamplesPerSecond = lNumSamples / lNumSeconds
End If
txtReadTime.Caption = lNumSamples & " returned in " & lEndTime - lStartTime & " seconds (" & lNumSamplesPerSec
Caption = "Output values for " & lbTags.Text & " (" & TagCount & ")" VB.Screen.MousePointer = vbDefault 'done
Else
MsgBox "Not Connected" 
End If
Exit Sub
Error_Handle:
VB.Screen.MousePointer = vbDefault
Select Case Err.Number
Case Is = 6 'overflow
MsgBox "Error Number: " & Err.Number & Chr(13) & "Description: " & Err.Description & Chr(13) & "Check numb
Case Is = 13 'type mismatch
MsgBox "Error Number: " & Err.Number & Chr(13) & "Description: " & Err.Description & Chr(13) & "Check numb
Case Is = 91
MsgBox "Error Number: " & Err.Number & Chr(13) & "Check connection to server" 
Case Else
MsgBox "Error Number: " & Err.Number & Chr(13) & Err.Description, vbOKOnly, "Error" 
End Select

QueryRecordset Method (MessageRecordset Object)

Executes the message query based on the fields and criteria specified.

Syntax

object.QueryRecordset

Parameters

None

Returns

Boolean. Success/Failure.

Example

Dim MyRecordset As iHistorian_SDK.MessageRecordset
Dim I As Integer
Dim J As Integer
Dim lEndTime&, lStartTime&, lNumMessages& Dim lNumSeconds&, lNumMessagesPerSecond&
If CheckConnection = True Then
' Get A New Recordset
Set MyRecordset = ConnectedServer.Messages.NewRecordset
' Return Timestamp, Message Number, and Message String Fields In Query
With MyRecordset.Fields
.TimeStamp = True
.MessageNumber = True
.MessageString = True
End With
' Query messages for given start and end time
With MyRecordset.Criteria
.Clear
.StartTime = dtMessageStart.Value
.EndTime = dtMessageEnd.Value
If txtMessageContains.Text <> "" Then
.MessageString = txtMessageContains.Text
End If
End With
VB.Screen.MousePointer = vbHourglass ' wait wait wait
' Run Query lStartTime = Timer
If Not MyRecordset.QueryRecordset Then lEndTime = Timer
MsgBox "Query Failed..." & Chr(13) & MyRecordset.LastError
VB.Screen.MousePointer = vbDefault
Exit Sub
End If
lEndTime = Timer
' reset output list lstRetrievedMessages.Clear
' display all messages lNumMessages = 0
For J = 1 To MyRecordset.Item.Count
lstRetrievedMessages.AddItem Format(MyRecordset.Item(J).TimeStamp, "MM/dd/yyyy hh:mm:ss") & _
vbTab & MyRecordset.Item(J).MessageString lNumMessages = lNumMessages + 1
Next J
' calculate performance statistics lNumSeconds = lEndTime - lStartTime lNumMessagesPerSecond = lNumMessages If lNumSeconds > 0 Then
lNumMessagesPerSecond = lNumMessages / lNumSeconds
End If
VB.Screen.MousePointer = vbDefault
txtReadTime.Caption = lNumMessages & " returned in " & lEndTime - lStartTime & " seconds (" & lNumMessagesP 
End If

QueryRecordset Method (TagRecordset Object)

Executes the tag query based on the fields and criteria specified.

Syntax

object.QueryRecordset

Parameters

None.

Returns

Boolean. Returns whether the QueryRecordset operation succeeded.

Example

Dim MyTags As iHistorian_SDK.Tags
Dim MyRecordset As iHistorian_SDK.TagRecordset
Dim lStartTime&, lEndTime&, lNumSeconds&, lNumTagsPerSecond& Dim I As Integer
On Error GoTo errc lbTags.Clear
' If we are connected to server
If CheckConnection = True Then
' Query all the tagnames
Set MyTags = ConnectedServer.Tags
Set MyRecordset = MyTags.NewRecordset 
MyRecordset.Criteria.Tagname = txtTagMask.Text 
If txtDescriptionMask.Text <> "" Then
MyRecordset.Criteria.Description = txtDescriptionMask.Text
End If MyRecordset.Fields.Clear 
MyRecordset.Fields.Tagname = True 
VB.Screen.MousePointer = vbHourglass  
lStartTime = Timer
If Not MyRecordset.QueryRecordset Then Err.Raise 1, , "Tag Query Failed: " + MyRecordset.LastError 
lEndTime = Timer
For I = 1 To MyRecordset.Item.Count
lbTags.AddItem MyRecordset.Item(I).Tagname
Next I
VB.Screen.MousePointer = vbDefault
' Calculate performance statistics 
lNumSeconds = lEndTime - lStartTime 
lNumTagsPerSecond = MyRecordset.Item.Count 
If lNumSeconds > 0 Then
lNumTagsPerSecond = MyRecordset.Item.Count / lNumSeconds
End If
lblAddTime.Caption = MyRecordset.Item.Count & " tags returned in " & lEndTime - lStartTime & " seconds (" & lN MyRecordset.ClearRecordset
Set MyRecordset = Nothing
Else
MsgBox "Not connected" 
End If
Exit Sub errc:
MsgBox "TestBrowseTags >> " + Err.Description                                                

QueryTagAlias Method (TagRecordset Object )

This function returns a list of tag aliases for the tag name passed in. Pass in the current name of the tag and this function will return if there are any previous names for the tag due to tag rename.

Syntax object.QueryTagAlias(TagNames(), NumberofTags, TagAlias(), NoOfAliases)

Table 6. Parameters
NameData TypeDescription
TagNames() StringName of the tags to return information on.
NumberofTags LongTotal count of tag names passed in. This must be equal to 1.
TagAlias() StringList of 0 or more tag aliases.
NoOfAliases IntegerThe number of tag aliases returned.

Returns

Boolean. TRUE if successful. FALSE otherwise.

QueryUserDefinedType Method (UserDefinedType Object)

Queries the Historian Server and loads all the User Defined Types that match the query mask.

Syntax

object.QueryUserDefinedType(Server, QueryMask)
Table 7. Parameters
NameData Type Description
ServerServerThe reference to the Historian Server object.
QueryMaskStringA mask string that can be used to search for UserDefinedType on the Historian Server. The string can include wild-card characters like "*" and "?".

Returns

Boolean. Indicates whether the query was successful.

R

Reload Method (Collector Object)

Causes a re-calculation of tags to occur for a specified tag period. You can reload all tags for the time period or specify specific tags that you want to reload.
Note: This method is only supported by ServerToServer and Calculation collectors.

Syntax

object.Reload(StartTime, EndTime, [Tags])

Table 8. Parameters
Name Data Type Description
StartTime DateThe time that you want the reload to begin at (read-only).
EndTimeDateThe time that you want the reload to end at (read-only).
TagsVariantThe specified tag names either in an array of tag names, or in a tagRecordset object for tags that you want to reload (optional).

Returns

Boolean. Returns whether or not the Reload operation succeeded.

Remove Method (TagDependencies Object)

Removes a Tag dependency from the current calculation.
CAUTION: If no Tagname is specified, all the Tag dependencies will be removed.

Syntax

object.Remove([Tagname])

Table 9. Parameters
Name Data Type Description
Tagname VariantName of the tag to remove (optional), default = "").

Returns

Boolean. Whether the Remove operation succeeded.

RemoveServer Method (ServerManager Object)

Removes the specified server from the list of registered servers on the client.

Syntax

object.RemoveServer(ServerName)

Table 10. Parameters
Name Data Type Description
ServerName StringComputer name of the Historian server (read/write).

Returns

Boolean. Whether the server was successfully removed from the list.

Rename Method (Tags Object)

Use this method to rename tag names. You can rename a tag permanently by passing an additional parameter as TRUE or FALSE.
Note: This method is called within the WriteRecordset method. For more information, refer to the Sample Code section.

Syntax

object.Rename(newTagName, (Optional) RenamePermanent)

Table 11. Parameters
Name Data Type Description
newTagName String Name of the new tag to rename.
RenamePermanent (Optional) Boolean Pass TRUE to permanently rename a tag.

Returns

Boolean. Returns whether or not the Rename operation succeeded.

Restore Alarms Method

Restores the alarms.

Syntax

object.RestoreAlarms

Table 12. Parameters
Name Data Type Description
RestoreFileName StringThe name of the file to be restored to the absolute path.

Returns

Boolean. Returns TRUE if the alarms have been restored.

Example

Dim Status As ihStatus
Dim ReturnStatus As Boolean Status = ihSTATUS_FAILED ReturnStatus = False
On Error GoTo errc
Status = ihRestoreAlarms(MyServer.Handle, RestoreFileName, 0)
If Status <> ihSTATUS_OK Then err.Raise 1, , "Error in restoring the alarms [" + ErrorDescription(Status) + "," ReturnStatus = True
RestoreAlarms = ReturnStatus errc:
zLastError = "Purge Alarms>> " + err.Description
RestoreAlarms = ReturnStatus
End Function

S

SaveSet Method (EnumeratedSets Object)

Saves the Enumerated Set that has been passed into the Historian Server.

Syntax

object.SaveSet(SetTosave)

Table 13. Parameters
Name Data Type Description
SetToSave EnumeratedSetThe set that is passed in to be saved.

Returns

None.

SaveSet Method (UserDefinedType Object)

Saves the UserDefinedType that has been passed into the Historian Server.

Syntax

object.SaveSet(Handle, MySet, Datatype)
Table 14. Parameters
Name Data Type Description
Handle LongServer handle.
MySetUserDefinedTypeThe UserDefinedType to be saved.
DataTypeihDatatypeThe data type of the UserDefinedType

Returns

Boolean. Returns TRUE if the UserDefinedType is saved.

SaveToCollectorProperty Method (OPCFilters Object)

Saves the current filter configuration in the Collector object.

Syntax

object.SaveToCollectorProperty(Collector)

Table 15. Parameters
Name Data Type Description
Collector VariantThe Collector object in which to save the filtering information.

Returns

Boolean true on success, false otherwise.

SaveUserCalcLibrary Method (Server Object)

Saves the given user calculation library to the Server object. This will update the set of user-created functions and subroutines available for calculations on this Server. The new calculation library must be passed in as an array of UserCalcFunctions.

This list of functions will replace any existing user calculation library on the Server. To save an empty calculation library, pass a non-array value such as Empty.

Syntax

object.SaveUserCalcLibrary(UserCalcFunctions)

Table 16. Parameters
Name Data Type Description
UserCalcFunctionsVariant Array of UserCalcFunction objects.

Returns

Boolean. Returns whether or not the calculation library was saved successfully.

Example

Dim MyServer As New iHistorian_SDK.Server
Dim MyUserCalcFunctions() As iHistorian_SDK.UserCalcFunction
Dim MyNewFunction As New iHistorian_SDK.UserCalcFunction
' Connect to the local server
If Not MyServer.Connect("", "", "") Then
err.Raise 1, , "Failed to connect to the local server" End If
' Load the calculation library
MyServer.LoadUserCalcLibrary MyUserCalcFunctions
' Create a new function
MyNewFunction.Name = "Sum"
MyNewFunction.Definition = "Function Sum(a, b)" & vbCrLf & "Sum = a + b" & vbCrLf & "End Function"
' Add it to the loaded library
If IsArray(MyUserCalcFunctions) Then
ReDim Preserve MyUserCalcFunctions(UBound(MyUserCalcFunctions) + 1) Else
ReDim MyUserCalcFunctions(0) End If
Set MyUserCalcFunctions(UBound(MyUserCalcFunctions)) = MyNewFunction
' Save the changes to the calculation library
If Not MyServer.SaveUserCalcLibrary(MyUserCalcFunctions) Then err.Raise 1, , "Failed to save the calculation library"
End If

SelectAll Method (TagRecordset Object)

Selects each tag in the current TagRecordset. Use in conjunction with the Master tag to perform bulk update operations on the selected tags of the TagRecordset.

Syntax

object.SelectAll

Parameters

None.

Returns

None.

Example

' Query for tags
Set MyRecordset = MyServer.Tags.NewRecordset
MyRecordset.QueryRecordset
' Select all tags
MyRecordset.SelectAll
' Update the HiEngineeringUnits for all tags
MyRecordset.Master.HiEngineeringUnits = 300
' Commit changes
MyRecordset.WriteRecordset

SetFields Method (DataRecordset Object)

Sets the DataValue fields to return from the Historian server when a DataRecordset query is executed.

Syntax

object.SetFields(Params)

Table 17. Parameters
Name Data Type Description
Params Variant Array of DataValue fields to set.

Returns

Boolean. Success / Failure

SetFields Method (MessageRecordset Object)

Set a list of desired Fields to be returned for the messages.

Syntax

object.SetFields(Params)

Table 18. Parameters
Name Data Type Description
Params Variant Array of Message fields

Returns

Boolean. Success / Failure

SetFields Method (TagRecordset Object)

Sets the Fields to retrieve in the TagRecordSet.

Syntax

object.SetFields(Params)

Table 19. Parameters
Name Data Type Description
Params Variant The array of field values to set.

Returns

Boolean. Success / failure.

SetNames Method (EnumeratedSets Object)

This function returns an array of names of all the loaded Enumerated Sets within the Historian server object.

Syntax

object.SetNames()

Parameters

None.

Returns

String Array.

ShowErrorListDialog Method (Server Object)

Displays a dialog box that details errors messages accumulated during the current session of the Server object. Each message is timestamped at the time the error generated and includes an error message translated into the locale of the client when possible.

Syntax

object.ShowErrorListDialog

Parameters

None.

Returns

None

Example

ErrorTrap:
' On error display the error list dialog
If MyServer.ErrorList.count > 0 Then
MyServer.ShowErrorListDialog
End If

SubscribeAlerts Method (Messages Object)

Subscribes to alert messages reported by the Historian Server. As the server receives alerts, the Historian server publishes messages to any client signed up for alerts.
  • To subscribe to messages of specific types, supply a topic.
  • To subscribe to all topics, do not supply a topic. Subscribe all is the default.
  • Subscribe to individual topics by making multiple calls to the SubscribeAlerts with different topics.
  • To subscribe to all topics, call SubscribeAlerts and pass 0.
  • To unsubscribe to a specific topic or all topics, call SubscribeAlerts and supply the Subscribe parameter set to False.

The Alert_Received event of the Messages object reports alert messages to the client asynchronously.

Syntax

object.SubscribeAlerts(Topic, Subscribe)

Table 20. Parameters
Name Data Type Description
Topic ihMessageTopic Topics of Alerts to subscribe to (optional, default = All).
Subscribe Boolean Flag to subscribe / unsubscribe to alerts (optional, default = True). Set to False to unsubscribe.

Returns

Boolean. Returns whether or not the SubscribeAlerts operation succeeded.

SubscribeChanges Method (Tags Object)

Subscribes to changes in tag configuration. The Historian server publishes messages to any client signed up for tag configuration changes as modifications are saved to the tag database.

The system reports tag configuration messages asynchronously to the client through the ChangeReceived event of the Tags Object.

To unsubscribe to a specific tag, or all tags, call SubscribeChanges and supply the Subscribe parameter set to False.

Syntax

object.SubscribeChanges(Tagname, Subscribe)

Table 21. Parameters
Name Data Type Description
Tagname StringName of tag to Subscribe for configuration changes (read-only).
SubscribeBooleanFlag to Subscribe/Unsubscribe to tag changes (default = True).

Returns

Boolean. Returns whether or not the SubscribeChanges operation succeeded.

SubscribeData Method (Data Object)

Subscribes to changes in the current value of a specific tag. The Historian server publishes messages as new values are received to any client signed up for current value changes. To qualify as a new current value, any new data point must have a newer timestamp than the previously established current value. Values received by the Historian server have passed a deadband check by the collector reporting the data. Since new current values have not been compressed, however, values reported as current may not exactly match those that reach the archive.

You can use the MinimumElapsedTime, in milliseconds, to throttle the rate at which current values are reported to a specific server connection. If the same tag is subscribed twice, the last supplied MinimumElapsedTime is used. If MinimumElapsedTime is not supplied, or is zero, the system reports all current values.

The system reports current values asynchronously to the client through the DataReceived event of the Data object.

To unsubscribe to a specific tag, or all tags, call SubscribeData and set the Subscribe parameter to False.

Syntax

object.SubscribeData(Tagname, MinimumElapsedTime, Subscribe)

Table 22. Parameters
Name Data Type Description
Tagname StringName of the tag to Subscribe for current values (read-only).
MinimumElapsedTimeMinimumElapsedTimeMinimum elapsed time (ms) between values (read-only).
SubscribeBooleanFlag to subscribe/unsubscribe to current values (read-only).

Returns

Boolean. Operation success / fail

SubscribeMessages Method (Messages Object)

Subscribes to messages reported by the Historian Server. The Historian Server publishes messages as messages are received to any client signed up for messages. As an option, you may supply a topic to subscribe only to messages of specific types. If you do not supply a topic, all topics are subscribed. You can subscribe to individual topics by making multiple calls to the SubscribeMessages method with different topics, or pass 0 to subscribe to all topics.

The system reports alert messages asynchronously to the client through the Message_Received event of the Messages object.

To unsubscribe to a specific topic, or all topics, call SubscribeMessages and set the Subscribe parameter to False.

Syntax

object.SubscribeMessages(Topic, Subscribe)

Table 23. Parameters
Name Data Type Description
Topic ihMessageTopicTopics of messages to Subscribe to (optional, default = True).
SubscribeBooleanFlag to un/subscribe to a specific topic (optional, default = True).

Returns

Boolean. Operation success / fail

Substitutions Method (MessageFields Object)

Determines whether the Substitutions should be returned in the MessageRecordset query.

Syntax

object.Substitutions

Parameters

None

Returns

None

Example

Dim maMyMessages As iHistorian_SDK.MessageRecordset 
Set MyMessages = GetServer.Messages.NewRecordset With MyMessages.Fields
.Topic = True
.TimeStamp = True
.MessageString = True
.Substitutions = True
End With 

T

TestCalculation Method (Tag Object)

Runs the calculation currently stored in the Calculation property. This calculation will be run with a current time of "Now". The results of the calculation will be stored in the Value and DataQuality parameters.

If an error occurs during the test, a description of the error will be stored in the ErrorMessage parameter.

Syntax

object.TestCalculation(Value, DataQuality, ErrorMessage)

Table 24. Parameters
Name Data Type Description
ValueVariantValue of the calculation result.
DataQualityStringQuality of the calculation result.
ErrorMessageStringDescription of any error that occurred during the test.

Returns

Boolean. Operation success / fail

TranslateMessage Method (Server Object)

Returns a translated message or prompt based on the current locale and the MessageNumber specified. If no translation is available for the current locale, the method uses the default message.

To insert context specific information into the generic message string, use substitutions. For example, the generic message string:
Connection To Server:[1] 
Failed With Error Number: [2]
requires two substitutions, the first being the server, and the second being the error number.
The substituted message then reads:
Connection To Server: USGB014 
Failed With Error Number: 65535. 

Syntax

object.TranslateMessage(MessageNumber, DefaultMessage, Substitutions)
Table 25. Parameters
Name Data Type Description
MessageNumber LongMessage or prompt number to translate (read-only).
DefaultMessageStringDefault message to translate (optional, read-only).
SubstitutionsParamArrayOrdered substitutions into message (optional, read-only).

Returns

String. The translated message text.

Example

Dim MyServer As New iHistorian_SDK.Server
Dim MyPrompt As String
' Connect to the default server
If Not MyServer.Connect Then
err.Raise 1, , "Failed to authenticate on server " + MyServer.ServerName
End If
' Translate the prompt from the connected server
MyPrompt = MyServer.TranslateMessage(549, "User: [1]", MyServer.Username)
' Prompt is translated to "User: Fred"