Method Reference M-P
M
ManageServerDialog Method (ServerManager Object)
Displays a dialog box to manage server connection information on the client. This dialog box allows you to add and remove new connections, and to modify the default username and password. This method optionally returns the name of the server last selected in the dialog.
Syntax
Name | Data Type | Description |
---|---|---|
SelectedServer | String | Name of the selected Historian Server (optional, read/write). |
Returns
None.
Dim MyManager As New iHistorian_SDK.ServerManager
Dim MyServer As iHistorian_SDK.Server
Dim SelectedServer As String
' Show the manage server dialog
MyManager.ManageServerDialog SelectedServer
' If a server was selected, get the server
If Trim(SelectedServer) <> "" Then
Set MyServer = MyManager.Servers(SelectedServer) End If
N
NewRecordset Method (Data Object)
Returns a new DataRecordset object to subsequently build a query for tag data from the Historian server. It is the responsibility of the developer to release the DataRecordset object when processing has been completed. DataRecordset objects may be re-used by re-executing a query with new criteria set through the DataCriteria of the DataRecordset object.
You must also use a new DataRecordset object to add new data points to the system and delete existing data points from the system. Changes are not committed until calling the WriteRecordset method of the DataRecordset object.
Syntax
object.NewRecordset
Parameters
None
Returns
DataRecordset. A new, empty, DataRecordset object.
NewRecordset Method (Messages Object)
Returns a new MessageRecordset object to build a query for messages and alerts from the Historian server message archive. You must release the MessageRecordset object when processing completes. You can re-use a MessageRecordset object by re-executing a query with new criteria set through the MessageCriteria of the MessageRecordset object.
To add new messages, you must use a new MessageRecordset object. Call the WriteRecordset method of the MessageRecordset object to commit changes to the archiver.
Syntax
object.NewRecordset
Parameters
None
Returns
MessageRecordset. Returns the newly created MessageRecordset object.
NewRecordset Method (Tags Object)
Returns a new TagRecordset object to build a query for tag information. You must terminate the TagRecordset object when processing completes. You can re-use the TagRecordset objects by re-executing a query with new criteria set through the TagCriteria of the TagRecordset object.
You must also use a new TagRecordset object to add new tags to the system and to delete tags from the system. Call the WriteRecordset Method of the TagRecordset object to commit changes to the archiver.
Syntax
object.NewRecordset
Parameters
None.
Returns
TagRecordset. Returns a reference to the newly created Recordset Object.
Purge Alarms By Id Method
Purges a single alarm as identified by its alarm ID.
Syntax
object.AlarmIdsName | Data Type | Description |
---|---|---|
AlarmIds | Long | Alarm ID of the alarm. |
Returns
Boolean. Returns TRUE if the alarm is purged.
Example
Dim Status As ihStatus
Dim ReturnStatus As Boolean
Dim Alarms() As Long
Dim NumberOfAlarms As Long
Dim i As Long
Status = ihSTATUS_FAILED ReturnStatus = False
NumberOfAlarms = (UBound(AlarmIds) + 1)
ReDim Alarms(0 To NumberOfAlarms - 1) As Long
On Error GoTo errc
For i = 0 To NumberOfAlarms - 1
Alarms(i) = AlarmIds(i)
Next i
Status = ihPurgeAlarmsById(MyServer.Handle, Alarms(0), NumberOfAlarms, 0)
If Status <> ihSTATUS_OK Then err.Raise 1, , "Error Purging alarms by Id[" + ErrorDescription(Status) + "," + CS ReturnStatus = True
PurgeAlarmsById = ReturnStatus errc:
zLastError = "Purge Alarms By Id>> " + err.Description
PurgeAlarmsById = ReturnStatus
End Function
Purge Alarms Method
Purges or deletes the alarms from the Archiver.
Syntax
object.PurgeAlarms
Name | Data Type | Description |
---|---|---|
BackupFile | String | The file that stores the purged alarm data. |
ShouldZipAlarms | Boolean | Indicates whether the alarms should be zipped into file or not. |
StartTime | Date | Start time of the alarms. |
EndTime | Date | End time of the alarms. |
Returns
Boolean. Returns TRUE if the alarms are purged.
Example
Dim Status As ihStatus
Dim AlarmsStartTime As ihTimeStruct Dim AlarmsEndTime As ihTimeStruct Dim ShouldZip As ihBoolean
Dim ReturnStatus As Boolean
Status = ihSTATUS_FAILED ReturnStatus = False
AlarmsStartTime = Date_To_UTC(StartTime) AlarmsEndTime = Date_To_UTC(EndTime)
If ShouldZipAlarms = True Then
ShouldZip = ihTRUE Else
ShouldZip = ihFALSE End If
On Error GoTo errc
Status = ihPurgeAlarms(MyServer.Handle, BackupFile, ShouldZip, AlarmsStartTime, AlarmsEndTime, 0)
If Status <> ihSTATUS_OK Then err.Raise 1, , "Error Purging alarms [" + ErrorDescription(Status) + "," + CStr(St
ReturnStatus = True PurgeAlarms = ReturnStatus errc:
zLastError = "Purge Alarms>> " + err.Description
PurgeAlarms = ReturnStatus
End Function