System Errors

GetSystemErrors

  • The GetSystemErrors Function returns a list of the System Errors from the System Type, Group, and Category specified.
  • The CurrentlyInError returns a Boolean error with a value of True if the System Type, Group, or Category is in error and False if it is not, This list should be the same length as the number of System Error names that are returned.
  • To return a list of all System Types that are in error or have had an error specify System Type as blank.
  • To return a list of all Groups that are in error or have had an error specify the System Type to obtain and Group as blank.
  • To return a list of all Categories that are in error or have had an error specify the System Type and Group to obtain and Category as blank.
  • To return a history list of all previous system error messages specify the System Type, Group, and Category to obtain the messages from.
  • Returns Empty String Array if service is not reachable.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • ErrorString will be set to Success when function is successful and an error message when in error.
  • RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.

VB

    Private Sub ButtonGetSystemErrors_Click(sender As System.Object, e As System.EventArgs) Handles ButtonGetSystemErrors.Click
        Cursor.Current = Cursors.WaitCursor
        Dim localGetSystemTypes As Boolean
        Dim localGetGroups As Boolean
        Dim localGetCategories As Boolean
        Dim localSystemType As String = ""
        Dim localGroup As String = ""
        Dim localCategory As String = ""
 
        ComboBoxPreviousMessages.Items.Clear()
 
        If ComboBoxSystemType.SelectedItem = "" Then
            localGetSystemTypes = True
            ComboBoxSystemType.Items.Clear()
            ComboBoxGroup.Items.Clear()
            ComboBoxCategory.Items.Clear()
        ElseIf ComboBoxGroup.SelectedItem = "" Then
            localSystemType = ComboBoxSystemType.SelectedItem.Remove(0, 8)
            localGetGroups = True
            ComboBoxGroup.Items.Clear()
            ComboBoxCategory.Items.Clear()
        ElseIf ComboBoxCategory.SelectedItem = "" Then
            localSystemType = ComboBoxSystemType.SelectedItem.Remove(0, 8)
            localGroup = ComboBoxGroup.SelectedItem.Remove(0, 8)
            localGetCategories = True
            ComboBoxCategory.Items.Clear()
        Else
            localSystemType = ComboBoxSystemType.SelectedItem.Remove(0, 8)
            localGroup = ComboBoxGroup.SelectedItem.Remove(0, 8)
            localCategory = ComboBoxCategory.SelectedItem.Remove(0, 8)
        End If
        Dim SystemErrors() As String
        Dim CurrentlyInError(-1) As Boolean
        Dim ErrorString As String = ""
 
 
        SystemErrors = ModuleNetworkNode.OPCSystemsComponent1.GetSystemErrors(localSystemType, localGroup, localCategory, CurrentlyInError, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            Dim localIndex As Int32
            For localIndex = 0 To SystemErrors.GetLength(0) - 1
                If localGetSystemTypes Then
                    If CurrentlyInError(localIndex) Then
                        ComboBoxSystemType.Items.Add("Error - " + SystemErrors(localIndex))
                    Else
                        ComboBoxSystemType.Items.Add("OK -    " + SystemErrors(localIndex))
                    End If
                    If localIndex = 0 Then
                        ComboBoxSystemType.SelectedIndex = 0
                    End If
                ElseIf localGetGroups Then
                    If CurrentlyInError(localIndex) Then
                        ComboBoxGroup.Items.Add("Error - " + SystemErrors(localIndex))
                    Else
                        ComboBoxGroup.Items.Add("OK -    " + SystemErrors(localIndex))
                    End If
                    If localIndex = 0 Then
                        ComboBoxGroup.SelectedIndex = 0
                    End If
                ElseIf localGetCategories Then
                    If CurrentlyInError(localIndex) Then
                        ComboBoxCategory.Items.Add("Error - " + SystemErrors(localIndex))
                    Else
                        ComboBoxCategory.Items.Add("OK -    " + SystemErrors(localIndex))
                    End If
                    If localIndex = 0 Then
                        ComboBoxCategory.SelectedIndex = 0
                    End If
                Else
                    ComboBoxPreviousMessages.Items.Add(SystemErrors(localIndex))
                    If localIndex = 0 Then
                        ComboBoxPreviousMessages.SelectedIndex = 0
                    End If
                End If
            Next
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
 
    End Sub

C#

	        private void ButtonGetSystemErrors_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     bool localGetSystemTypes = false;
                     bool localGetGroups = false;
                     bool localGetCategories = false;
                     string localSystemType = "";
                     string localGroup = "";
                     string localCategory = "";
 
                     ComboBoxPreviousMessages.Items.Clear();
 
                     if (string.IsNullOrEmpty(ComboBoxSystemType.SelectedItem.ToString()))
                     {
                           localGetSystemTypes = true;
                           ComboBoxSystemType.Items.Clear();
                           ComboBoxGroup.Items.Clear();
                           ComboBoxCategory.Items.Clear();
                     }
                     else if (string.IsNullOrEmpty(ComboBoxGroup.SelectedItem.ToString()))
                     {
                localSystemType = ComboBoxSystemType.SelectedItem.ToString().Remove(0, 8);
                            localGetGroups = true;
                           ComboBoxGroup.Items.Clear();
                           ComboBoxCategory.Items.Clear();
                     }
                     else if (string.IsNullOrEmpty(ComboBoxCategory.SelectedItem.ToString()))
                     {
                localSystemType = ComboBoxSystemType.SelectedItem.ToString().Remove(0, 8);
                localGroup = ComboBoxGroup.SelectedItem.ToString().Remove(0, 8);
                           localGetCategories = true;
                           ComboBoxCategory.Items.Clear();
                     }
                     else
                     {
                localSystemType = ComboBoxSystemType.SelectedItem.ToString().Remove(0, 8);
                localGroup = ComboBoxGroup.SelectedItem.ToString().Remove(0, 8);
                localCategory = ComboBoxCategory.SelectedItem.ToString().Remove(0, 8);
                     }
                     string[] SystemErrors = null;
                     bool[] CurrentlyInError = new bool[0];
                     string ErrorString = "";
 
 
                     SystemErrors = ModuleNetworkNode.OPCSystemsComponent1.GetSystemErrors(localSystemType, localGroup, localCategory, ref CurrentlyInError, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           Int32 localIndex = 0;
                           for (localIndex = 0; localIndex < SystemErrors.GetLength(0); localIndex++)
                           {
                                  if (localGetSystemTypes)
                                  {
                                         if (CurrentlyInError[localIndex])
                                         {
                                                ComboBoxSystemType.Items.Add("Error - " + SystemErrors[localIndex]);
                                         }
                                         else
                                         {
                                                ComboBoxSystemType.Items.Add("OK -    " + SystemErrors[localIndex]);
                                         }
                                         if (localIndex == 0)
                                         {
                                                ComboBoxSystemType.SelectedIndex = 0;
                                         }
                                  }
                                  else if (localGetGroups)
                                  {
                                         if (CurrentlyInError[localIndex])
                                         {
                                                ComboBoxGroup.Items.Add("Error - " + SystemErrors[localIndex]);
                                         }
                                         else
                                         {
                                                ComboBoxGroup.Items.Add("OK -    " + SystemErrors[localIndex]);
                                         }
                                         if (localIndex == 0)
                                         {
                                                ComboBoxGroup.SelectedIndex = 0;
                                         }
                                  }
                                  else if (localGetCategories)
                                  {
                                         if (CurrentlyInError[localIndex])
                                         {
                                                ComboBoxCategory.Items.Add("Error - " + SystemErrors[localIndex]);
                                         }
                                         else
                                         {
                                                ComboBoxCategory.Items.Add("OK -    " + SystemErrors[localIndex]);
                                         }
                                         if (localIndex == 0)
                                         {
                                                ComboBoxCategory.SelectedIndex = 0;
                                         }
                                  }
                                  else
                                  {
                                         ComboBoxPreviousMessages.Items.Add(SystemErrors[localIndex]);
                                         if (localIndex == 0)
                                         {
                                                ComboBoxPreviousMessages.SelectedIndex = 0;
                                         }
                                  }
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
 
              }
 
              private void ButtonReset_Click(object sender, System.EventArgs e)
              {
                     ComboBoxSystemType.Items.Clear();
                     ComboBoxGroup.Items.Clear();
                     ComboBoxCategory.Items.Clear();
                     ComboBoxPreviousMessages.Items.Clear();
              }