Tag Groups

GetGroupNames

  • The GetGroupNames Function returns a list of Groups in the specified ReferenceGroup path.
  • Returns Empty String Array if service is not reachable.
  • Returns a String Array of Groups in the ReferenceGroup.
  • ReferenceGroup is a string of the Group path to retrieve the Groups from.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonGetGroupNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetGroupNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetGroupNames.Items.Clear()
        Dim GroupNames() As String
        Dim GroupName As String
        Dim ErrorString As String = ""
        GroupNames = ModuleNetworkNode.OPCSystemsComponent1.GetGroupNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each GroupName In GroupNames
                ComboBoxGetGroupNames.Items.Add(GroupName)
            Next
            If ComboBoxGetGroupNames.Items.Count > 0 Then
                ComboBoxGetGroupNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub 
 
    
Private Sub ComboBoxGetGroupNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetGroupNames.SelectedIndexChanged
        TextBoxGroup.Text = ComboBoxGetGroupNames.SelectedItem
    End Sub

C#

 

	   private void ButtonGetGroupNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetGroupNames.Items.Clear();
                     string[] GroupNames = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string GroupName = null;
                     string ErrorString = "";
                     GroupNames = ModuleNetworkNode.OPCSystemsComponent1.GetGroupNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string GroupName in GroupNames)
                           {
                                  ComboBoxGetGroupNames.Items.Add(GroupName);
                           }
                           if (ComboBoxGetGroupNames.Items.Count > 0)
                           {
                                  ComboBoxGetGroupNames.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }
 
              private void ComboBoxGetGroupNames_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxGroup.Text = ComboBoxGetGroupNames.SelectedItem.ToString();
              }
	

AddGroup

  • The AddGroup Function adds a Group to the existing Tag configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group already exists or adding the Group failed.
  • Group is the name of the Group to add.
  • ReferenceGroup is a string of the Group path to add the Group to.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonAddGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddGroup(TextBoxGroup.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddGroupResult.Text = "Group successfully added."
        Else
            LabelAddGroupResult.Text = ErrorString
        End If
 
    End Sub

C#

 

	
	   private void ButtonAddGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddGroup(TextBoxGroup.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelAddGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelAddGroupResult.Text = "Group successfully added.";
                     }
                     else
                     {
                           LabelAddGroupResult.Text = ErrorString;
                     }
 
              }

RemoveGroup

  • The RemoveGroup Function removes a Group to the existing Tag configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group does not exist or removing the Group failed.
  • Group is the name of the Group to remove.
  • ReferenceGroup is a string of the Group path to remove the Group from.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonRemoveGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveGroup(TextBoxGroup.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRemoveGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRemoveGroupResult.Text = "Group successfully removed."
        Else
            LabelRemoveGroupResult.Text = ErrorString
        End If
 
    End Sub

C#

 

	  private void ButtonRemoveGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveGroup(TextBoxGroup.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelRemoveGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                            LabelRemoveGroupResult.Text = "Group successfully removed.";
                     }
                     else
                     {
                           LabelRemoveGroupResult.Text = ErrorString;
                     }
 
              }
	

RenameGroup

  • The RenameGroup Function renames an existing Group in the Tag configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Old Group does not exist, the New Group already exists, or renaming the Group failed.
  • OldGroup is the name of the existing Group to rename.
  • NewGroup is the name to change the Group to.
  • ReferenceGroup is a string of the Group path to rename the Group in.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

Private Sub ButtonRenameGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRenameGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RenameGroup(TextBoxGroup.Text, TextBoxNewGroupName.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRenameGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRenameGroupResult.Text = "Group successfully renamed."
        Else
            LabelRenameGroupResult.Text = ErrorString
        End If
    End Sub

C#

 

	     private void ButtonRenameGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RenameGroup(TextBoxGroup.Text, TextBoxNewGroupName.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelRenameGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelRenameGroupResult.Text = "Group successfully renamed.";
                     }
                     else
                     {
                           LabelRenameGroupResult.Text = ErrorString;
                     }
              }
	

GetAllAlarmGroups

  • The GetAllAlarmGroups Function returns a list of Alarm Groups in the current Tag Configuration.
  • 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.
  • Optional ErrorString will be set to Success when function is successful and an error message is in error.

VB

Private Sub ButtonGetAllAlarmGroups_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetAllAlarmGroups.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetAllAlarmGroups.Items.Clear()
        Dim GroupNames() As String
        Dim GroupName As String
        Dim ErrorString As String = ""
        GroupNames = ModuleNetworkNode.OPCSystemsComponent1.GetAllAlarmGroups(TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each GroupName In GroupNames
                ComboBoxGetAllAlarmGroups.Items.Add(GroupName)
            Next
            If ComboBoxGetAllAlarmGroups.Items.Count > 0 Then
                ComboBoxGetAllAlarmGroups.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

 

	  private void ButtonGetAllAlarmGroups_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetAllAlarmGroups.Items.Clear();
                     string[] GroupNames = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string GroupName = null;
                     string ErrorString = "";
                     GroupNames = ModuleNetworkNode.OPCSystemsComponent1.GetAllAlarmGroups(TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string GroupName in GroupNames)
                           {
                                  ComboBoxGetAllAlarmGroups.Items.Add(GroupName);
                           }
                           if (ComboBoxGetAllAlarmGroups.Items.Count > 0)
                           {
                                  ComboBoxGetAllAlarmGroups.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }