Alarms.PurgeAlarmsById

The following sample is used to develop an SDK sample for purging alarms by their alarm IDs.
Dim Alarms() As String
Dim AlarmIds() As Long
Dim i As Long
Dim numberOfAlarms As Long
Dim AlarmsObj As iHistorian_SDK.Alarms
Dim Status As Boolean
i = 0
numberOfAlarms = 0
Status = False
If CheckConnection = True Then
    Set AlarmsObj = ConnectedServer.Alarms
    If TextAlarmIds.Text = "" Then
    MsgBox "Alarms cannot be empty", vbCritical, "Historian"
    Exit Sub
End If
Trim (TextAlarmIds.Text)
'Multiple alarms are separated by semicolon
Alarms() = Split(TextAlarmIds.Text, ";")
numberOfAlarms = UBound(Alarms)
If numberOfAlarms <> 0 Then
ReDim AlarmIds(0 To numberOfAlarms) As Long
    For i = 0 To numberOfAlarms
    If Alarms(i) <> "" Then
        AlarmIds(i) = CLng(Alarms(i)) 
      End If
    Next
    Status = AlarmsObj.PurgeAlarmsById(AlarmIds()) 
    If Status <> True Then
    MsgBox "An error occurred while deleting the alarms. See the Historian Alerts for more details.", vbCritical, "Historian"         
  Else
    MsgBox "Successfully deleted the alarms.", vbInformation, "Historian" 
  End If
    TextAlarmIds.Text = "" 
  Else
   MsgBox "Please enter Alarm Ids followed by ';'", vbCritical, "Historian"
   End If
 Else
   MsgBox "Not connected", vbCritical, "Historian" 
  End If