Tags

The most commonly used methods are Get and Set Tag Properties to obtain and set desired properties of multiple tags in one call

Please note that the most efficient way to add tags and set their properties programmatically is using the SetTagProperty or TagCSVImport methods.

GetTagValuesByGroup

The GetTagValuesByGroup Function returns an array of Tag Names and Values for all of the Tags in the specified group. Tag Names and Values are alternating with the the array of tags.

Returns Empty Array if service is not reachable.

The returned array of objects will contain first the tag name followed by the value.

Example is element 0 contains Tag01, element 1 contains the value of Tag01 element 2 contains Tag02, element 3 contains the value of Tag02.

If the data quality of the Tag value is bad the individual returned value will be null.

The GroupName is the reference path of the group to get the values 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 ButtonGetTagValuesByGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTagValuesByGroup.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxGetTagValuesByGroup.Items.Clear()
    Dim TagNamesAndValues() As Object
    Dim TagName As String
    Dim ValueString As String
    Dim ErrorString As String = ""
    TagNamesAndValues = ModuleNetworkNode.OPCSystemsComponent1.GetTagValuesByGroup(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        Dim numberOfTags As Int32 = TagNamesAndValues.GetLength(0) / 2
        Dim tagIndex As Int32
        Dim itemIndex As Int32
        Dim tagsToAdd As New ArrayList

        For tagIndex = 0 To numberOfTags - 1
            TagName = TagNamesAndValues(itemIndex)
            itemIndex += 1
            If TagNamesAndValues(itemIndex) Is Nothing Then
                tagsToAdd.Add(TagName + " = Bad Quality")
            Else
                Try
                    ValueString = TagNamesAndValues(itemIndex).ToString
                    tagsToAdd.Add(TagName + " = " + ValueString)
                Catch ex As Exception
                    tagsToAdd.Add(TagName + " = Value Cannot Be Converted To String")
                End Try
            End If
            itemIndex += 1
        Next
        ComboBoxGetTagValuesByGroup.Items.AddRange(CType(tagsToAdd.ToArray(GetType(String)), String()))
        If ComboBoxGetTagValuesByGroup.Items.Count > 0 Then
            ComboBoxGetTagValuesByGroup.SelectedIndex = 0
        End If
    Else
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

C#

private void ButtonGetTagValuesByGroup_Click(object sender, System.EventArgs e) {
   System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
   ComboBoxGetTagValuesByGroup.Items.Clear();
   object[] TagNamesAndValues = null;
   string TagName = null;
   string ValueString = null;
   string ErrorString = "";
   TagNamesAndValues = ModuleNetworkNode.OPCSystemsComponent1.GetTagValuesByGroup(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
   if (ErrorString == "Success")
   {
         Int32 numberOfTags = Convert.ToInt32(TagNamesAndValues.GetLength(0) / 2);
         Int32 tagIndex = 0;
         Int32 itemIndex = 0;
         ArrayList tagsToAdd = new ArrayList();

         for (tagIndex = 0; tagIndex < numberOfTags; tagIndex++)
         {
                TagName = TagNamesAndValues[itemIndex].ToString();
                itemIndex += 1;
                if (TagNamesAndValues[itemIndex] == null)
                {
                       tagsToAdd.Add(TagName + " = Bad Quality");
                }
                else
                {
                       try
                       {
                              ValueString = TagNamesAndValues[itemIndex].ToString();
                              tagsToAdd.Add(TagName + " = " + ValueString);
                       }
                       catch (Exception ex)
                       {
                              tagsToAdd.Add(TagName + " = Value Cannot Be Converted To String");
                       }
                }
                itemIndex += 1;
         }
          ComboBoxGetTagValuesByGroup.Items.AddRange((string[])tagsToAdd.ToArray(typeof(string)));
         if (ComboBoxGetTagValuesByGroup.Items.Count > 0)
         {
                ComboBoxGetTagValuesByGroup.SelectedIndex = 0;
         }
   }
   else
   {
         MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
   }
}

GetTagNames

The GetTagNames Function returns a list of Tags in the specified ReferenceGroup path.

Returns Empty String if service is not reachable.

Returns a String Array of Tags in the ReferenceGroup.

ReferenceGroup is a string of the Group path to retrieve the Tags 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 ButtonGetTagNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTagNames.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxGetTagNames.Items.Clear()
    Dim TagNames() As String
    Dim TagName As String
    Dim ErrorString As String = ""
    TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        For Each TagName In TagNames
            ComboBoxGetTagNames.Items.Add(TagName)
        Next
        If ComboBoxGetTagNames.Items.Count > 0 Then
            ComboBoxGetTagNames.SelectedIndex = 0
        End If
    Else
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

C#

private void ButtonGetTagNames_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxGetTagNames.Items.Clear();
     string[] TagNames = null;
     string ErrorString = "";
     TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString == "Success")
     {
           foreach (string TagName in TagNames)
           {
                  ComboBoxGetTagNames.Items.Add(TagName);
           }
           if (ComboBoxGetTagNames.Items.Count > 0)
           {
                  ComboBoxGetTagNames.SelectedIndex = 0;
           }
     }
     else
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}

GetAllTagNames

The GetAllTagNames Function returns a list of all of the Tags from the specified ReferenceGroup path and all tags in all sub groups within the Reference Group.

Returns Empty String Array if service is not reachable.

Returns a String Array of Tags in the ReferenceGroup and all tags within the sub groups of the Reference Group.

ReferenceGroup is a string of the Group path to retrieve the Tags from.

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 ButtonGetAllTagNames_Click(sender As System.Object, e As System.EventArgs) Handles ButtonGetAllTagNames.Click
    ComboBoxGetTagNames.Items.Clear()
    Dim TagNames() As String
    Dim TagName As String
    Dim ErrorString As String = ""
    TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetAllTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        For Each TagName In TagNames
            ComboBoxGetTagNames.Items.Add(TagName)
        Next
        If ComboBoxGetTagNames.Items.Count > 0 Then
            ComboBoxGetTagNames.SelectedIndex = 0
        End If
    Else
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

Private Sub ComboBoxGetTagNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetTagNames.SelectedIndexChanged
    TextBoxTag.Text = ComboBoxGetTagNames.SelectedItem
End Sub  

C#

private void ButtonGetAllTagNames_Click(object sender, System.EventArgs e) {
     ComboBoxGetTagNames.Items.Clear();
     string[] TagNames = null;
     string ErrorString = "";
     TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetAllTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString == "Success")
     {
           foreach (string TagName in TagNames)
           {
                  ComboBoxGetTagNames.Items.Add(TagName);
           }
           if (ComboBoxGetTagNames.Items.Count > 0)
           {
                  ComboBoxGetTagNames.SelectedIndex = 0;
           }
     }
     else
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}

private void ComboBoxGetTagNames_SelectedIndexChanged(object sender, System.EventArgs e) {
     TextBoxTag.Text = ComboBoxGetTagNames.SelectedItem.ToString();
}

AddTag

The AddTag Function adds a Tag to the existing Tag configuration.

*** Note to add multiple Tags with mutliple parameters use the TagCSVImport method as demonstrated under Configure-Tags

Returns -1 if service is not reachable.

Returns 1 if successful.

Returns 0 if the Tag already exists or adding the Tag failed.

Tag is the name of the Tag to add.

ReferenceGroup is a string of the Group path to add the Tag 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 is in error.

VB

Private Sub ButtonAddTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddTag.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ResultInt32 As Int32
    Dim ErrorString As String = ""
    ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddTag(TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ResultInt32 = -1 Then
        LabelAddTagResult.Text = "OAS Service not reached."
    ElseIf ResultInt32 = 1 Then
        LabelAddTagResult.Text = "Tag successfully added."
    Else
        LabelAddTagResult.Text = ErrorString
    End If
End Sub

C#

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

RemoveTag

The RemoveTag Function removes a Tag to the existing Tag configuration.

Returns -1 if service is not reachable.

Returns 1 if successful.

Returns 0 if the Tag does not exist..

Tag is the name of the Tag to remove.

ReferenceGroup is a string of the Group path to remove the Tag 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 is in error.

VB

Private Sub ButtonRemoveTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveTag.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ResultInt32 As Int32
    Dim ErrorString As String = ""
    ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveTag(TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ResultInt32 = -1 Then
        LabelRemoveTagResult.Text = "OAS Service not reached."
    ElseIf ResultInt32 = 1 Then
        LabelRemoveTagResult.Text = "Tag successfully removed."
    Else
        LabelRemoveTagResult.Text = ErrorString
    End If
End Sub

C#

   

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

DeleteAllTags

The DeleteAllTags Function removes all Tags from the existing Tag configuration.

Returns -1 if service is not reachable.

Returns 0 if error occurs.

Returns 1 if successful.

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 ButtonDeleteAllTags_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDeleteAllTags.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ResultInt32 As Int32
    Dim ErrorString As String = ""
    ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.DeleteAllTags(TextBoxNetworkNode.Text, ErrorString)
    If ResultInt32 = 1 Then
        LabelDeleteAllTagsResult.Text = "All Tags successfully removed."
    Else
        LabelDeleteAllTagsResult.Text = ErrorString
    End If
End Sub

C#

private void ButtonDeleteAllTags_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     Int32 ResultInt32 = 0;
     string ErrorString = "";
     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.DeleteAllTags(TextBoxNetworkNode.Text, ref ErrorString);
     if (ResultInt32 == 1)
     {
           LabelDeleteAllTagsResult.Text = "All Tags successfully removed.";
     }
     else
     {
           LabelDeleteAllTagsResult.Text = ErrorString;
     }
}

GetTag_Parameter_Strings

The GetTag_Parameter_Strings Function returns an array of Strings containing all Parameter Types available for each Tag.

Returns Empty String Array if service is not reachable.

Returns a String Array of Parameter Types for all Tags.

NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

Private Sub ButtonGetTag_Parameter_Strings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTag_Parameter_Strings.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxGetTag_Parameter_Strings.Items.Clear()
    Dim Parameters() As String
    Dim Parameter As String
    Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Strings(TextBoxNetworkNode.Text)
    For Each Parameter In Parameters
        ComboBoxGetTag_Parameter_Strings.Items.Add(Parameter)
    Next
    If ComboBoxGetTag_Parameter_Strings.Items.Count > 0 Then
        ComboBoxGetTag_Parameter_Strings.SelectedIndex = 0
    End If
End Sub
Private Sub ComboBoxGetTag_Parameter_Strings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetTag_Parameter_Strings.SelectedIndexChanged
    TextBoxParameter.Text = ComboBoxGetTag_Parameter_Strings.SelectedItem
End Sub

C#

private void ButtonGetTag_Parameter_Strings_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxGetTag_Parameter_Strings.Items.Clear();
     string[] Parameters = null;
     Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Strings(TextBoxNetworkNode.Text);
     foreach (string Parameter in Parameters)
     {
           ComboBoxGetTag_Parameter_Strings.Items.Add(Parameter);
     }
     if (ComboBoxGetTag_Parameter_Strings.Items.Count > 0)
     {
           ComboBoxGetTag_Parameter_Strings.SelectedIndex = 0;
     }

}

private void ComboBoxGetTag_Parameter_Strings_SelectedIndexChanged(object sender, System.EventArgs e) {
     TextBoxParameter.Text = ComboBoxGetTag_Parameter_Strings.SelectedItem.ToString();
}

GetParameter_Property_Strings

The GetParameter_Property_Strings Function returns an array of Strings containing all property types available for each Parameter.

Returns Empty String Array if service is not reachable.

Returns a String Array of property types for all Parameters.

NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

Private Sub ButtonGetParameter_Property_Strings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetParameter_Property_Strings.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxGetParameter_Property_Strings.Items.Clear()
    Dim Properties() As String
    Dim PropertyType As String
    Properties = ModuleNetworkNode.OPCSystemsComponent1.GetParameter_Property_Strings(TextBoxNetworkNode.Text)
    For Each PropertyType In Properties
        ComboBoxGetParameter_Property_Strings.Items.Add(PropertyType)
    Next
    If ComboBoxGetParameter_Property_Strings.Items.Count > 1 Then
        ComboBoxGetParameter_Property_Strings.SelectedIndex = 2
    End If
End Sub
 
Private Sub ComboBoxGetParameter_Property_Strings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetParameter_Property_Strings.SelectedIndexChanged
    TextBoxProperty.Text = ComboBoxGetParameter_Property_Strings.SelectedItem
End Sub

C#

private void ButtonGetParameter_Property_Strings_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxGetParameter_Property_Strings.Items.Clear();
     string[] Properties = null;
     Properties = ModuleNetworkNode.OPCSystemsComponent1.GetParameter_Property_Strings(TextBoxNetworkNode.Text);
     foreach (string PropertyType in Properties)
     {
           ComboBoxGetParameter_Property_Strings.Items.Add(PropertyType);
     }
     if (ComboBoxGetParameter_Property_Strings.Items.Count > 1)
     {
           ComboBoxGetParameter_Property_Strings.SelectedIndex = 2;
     }

}

private void ComboBoxGetParameter_Property_Strings_SelectedIndexChanged(object sender, System.EventArgs e) {
     TextBoxProperty.Text = ComboBoxGetParameter_Property_Strings.SelectedItem.ToString();
}

GetTag_Parameter_Value

The GetTag_Parameter_Value Function returns an object value for the Tag.Parameter.Property specified.

Returns nothing if service is not reachable.

Parameter is a String of the Parameter Type desired of the Tag.

PropertyType is a String of the Property Type desired of the Parameter.

TagName is a String of the Tag desired.

ReferenceGroup is a String of the Group(s) where the Tag is to be contained.

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 ButtonGetTag_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTag_Parameter_Value.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ResultObject As Object
    Dim ErrorString As String = ""
    ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Value(TextBoxParameter.Text, TextBoxProperty.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        If ResultObject Is Nothing Then
            LabelGetTag_Parameter_ValueResult.Text = "OAS Service not reached or Tag, Parameter, or Property not found."
            TextBoxValueToSet.Text = ""
        Else
            Try
                LabelGetTag_Parameter_ValueResult.Text = ResultObject
                TextBoxValueToSet.Text = ResultObject
            Catch ex As Exception
                LabelGetTag_Parameter_ValueResult.Text = "Error converting value to string."
                TextBoxValueToSet.Text = ""
            End Try
        End If
    Else
        LabelGetTag_Parameter_ValueResult.Text = ErrorString
        TextBoxValueToSet.Text = ""
    End If
End Sub

C#

  

private void ButtonGetTag_Parameter_Value_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     object ResultObject = null;
     string ErrorString = null;
     ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Value(TextBoxParameter.Text, TextBoxProperty.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString);
     if (ErrorString == "Success") {
        if (ResultObject == null)
        {
            LabelGetTag_Parameter_ValueResult.Text = "OAS Service not reached or Tag, Parameter, or Property not found.";
            TextBoxValueToSet.Text = "";
        }
        else
        {
            try
             {
                LabelGetTag_Parameter_ValueResult.Text = ResultObject;
                TextBoxValueToSet.Text = ResultObject;
             }
             catch (Exception ex)
             {
                LabelGetTag_Parameter_ValueResult.Text = "Error converting value to string.";
                TextBoxValueToSet.Text = "";
             }

        }
     }
     else 
     {
        LabelGetTag_Parameter_ValueResult.Text = ErrorString;
        TextBoxValueToSet.Text = "";
     }
}

GetTag_Parameter_Values

The GetTag_Parameter_Values Function returns an array of object values for the Tag.Parameter specified.

The order of the array corresponds with the GetParameter_Property_Strings Function order.

Returns empty array if service is not reachable.

Parameter is a String of the Parameter Type desired of the Tag.

TagName is a String of the Tag desired.

ReferenceGroup is a String of the Group(s) where the Tag is to be contained.

NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

Private Sub ButtonGetTag_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTag_Parameter_Values.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxGetTag_Parameter_Values.Items.Clear()
    Dim ResultObjects() As Object
    Dim ResultObject As Object
    Dim ResultString As String
    ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Values(TextBoxParameter.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text)
    For Each ResultObject In ResultObjects
        Try
            If ResultObject Is Nothing Then
                ResultString = ""
            Else
                ResultString = ResultObject
            End If
            ComboBoxGetTag_Parameter_Values.Items.Add(ResultString)
        Catch ex As Exception
            ComboBoxGetTag_Parameter_Values.Items.Add("Error Converting Object")
        End Try
    Next
    If ComboBoxGetTag_Parameter_Values.Items.Count > 0 Then
        ComboBoxGetTag_Parameter_Values.SelectedIndex = 0
    End If
End Sub

C#

  

private void ButtonGetTag_Parameter_Values_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxGetTag_Parameter_Values.Items.Clear();
     object[] ResultObjects = null;
     string ResultString = null;
     ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetTag_Parameter_Values(TextBoxParameter.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text);
     foreach (object ResultObject in ResultObjects)
     {
           try
           {
                  if (ResultObject == null)
                  {
                         ResultString = "";
                  }
                  else
                  {
                         ResultString = ResultObject.ToString();
                  }
                  ComboBoxGetTag_Parameter_Values.Items.Add(ResultString);
           }
           catch (Exception ex)
           {
                  ComboBoxGetTag_Parameter_Values.Items.Add("Error Converting Object");
           }
     }
     if (ComboBoxGetTag_Parameter_Values.Items.Count > 0)
     {
           ComboBoxGetTag_Parameter_Values.SelectedIndex = 0;
     }
}

SetTag_Parameter_Value

The SetTag_Parameter_Value Function sets an object value for the Tag.Parameter.Property specified.

Returns -1 if service is not reachable.

Returns 1 if the function was successful.

Parameter is a String of the Parameter Type desired of the Tag.

PropertyType is a String of the Property Type desired of the Parameter.

Value is the desired value to set.

TagName is a String of the Tag desired.

ReferenceGroup is a String of the Group(s) where the Tag is to be contained.

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 ButtonSetTag_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetTag_Parameter_Value.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ResultInt32 As Int32
    Dim ErrorString As String = ""
    ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetTag_Parameter_Value(TextBoxParameter.Text, TextBoxProperty.Text, TextBoxValueToSet.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
    If ResultInt32 = -1 Then
        LabelSetTag_Parameter_ValueResult.Text = "OAS Service not reached."
    ElseIf ResultInt32 = 1 Then
        LabelSetTag_Parameter_ValueResult.Text = "Parameter Property Successfully Updated."
    Else
        LabelSetTag_Parameter_ValueResult.Text = ErrorString
    End If
End Sub

C#

  

private void ButtonSetTag_Parameter_Value_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     Int32 ResultInt32 = 0;
     string ErrorString = "";
     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetTag_Parameter_Value(TextBoxParameter.Text, TextBoxProperty.Text, TextBoxValueToSet.Text, TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
     if (ResultInt32 == -1)
     {
           LabelSetTag_Parameter_ValueResult.Text = "OAS Service not reached.";
     }
     else if (ResultInt32 == 1)
     {
           LabelSetTag_Parameter_ValueResult.Text = "Parameter Property Successfully Updated.";
     }
     else
     {
           LabelSetTag_Parameter_ValueResult.Text = ErrorString;
     }
}

SaveTagConfiguration

The SaveTagConfiguration Subroutine saves the current Tag configuration to the specified file path.

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 ButtonSaveTagConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveTagConfiguration.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ErrorString As String = ""
    ModuleNetworkNode.OPCSystemsComponent1.SaveTagConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString <> "Success" Then
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub 

C#

 
private void ButtonSaveTagConfiguration_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     string ErrorString = "";
     ModuleNetworkNode.OPCSystemsComponent1.SaveTagConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString != "Success")
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}

LoadTagConfiguration

The LoadTagConfiguration Subroutine saves the current Tag configuration to the specified file path.

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 ButtonLoadTagConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoadTagConfiguration.Click
    Cursor.Current = Cursors.WaitCursor
    Dim ErrorString As String = ""
    If ModuleNetworkNode.OPCSystemsComponent1.InRuntime(TextBoxNetworkNode.Text) = 1 Then
        MessageBox.Show("Cannot Load Tag configuraitons while in Runtime Mode", "Cannot Load Tags", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Exit Sub
    End If
    ModuleNetworkNode.OPCSystemsComponent1.LoadTagConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString <> "Success" Then
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

C#

  

private void ButtonLoadTagConfiguration_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     string ErrorString = "";
     if (ModuleNetworkNode.OPCSystemsComponent1.InRuntime(TextBoxNetworkNode.Text) == 1)
     {
           MessageBox.Show("Cannot Load Tag configuraitons while in Runtime Mode", "Cannot Load Tags", MessageBoxButtons.OK, MessageBoxIcon.Information);
           return;
     }
     ModuleNetworkNode.OPCSystemsComponent1.LoadTagConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString != "Success")
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}

CheckTagAccessRead

The CheckTagAccessRead Function returns a list of Tags that have read access from the UserName and Password specified.

This method requires Security access for Get Secuirty Parameters from the user and password specified in the LogIn method of the component.

Returns Empty String Array if service is not reachable.

Returns a String Array of Tags that are allowed for Read Access.

UserName is the user to verify with the Tags.

Password is the password of the user to verify with the Tags.

Tags is a list of tags to check in the service, do not include the remote network path in the tag names.

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 ButtonCheckTagAccessRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCheckTagAccessRead.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxCheckTagAccessRead.Items.Clear()
    Dim TagNames() As String
    Dim TagName As String
    Dim ErrorString As String = ""
    Dim TagsToCheck(2) As String
    TagsToCheck(0) = "Ramp.Value"
    TagsToCheck(1) = "Sine.Value"
    TagsToCheck(2) = "Random.Value"
    TagNames = ModuleNetworkNode.OPCSystemsComponent1.CheckTagAccessRead(TextBoxUserNameToCheck.Text, TextBoxPasswordToCheck.Text, TagsToCheck, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        For Each TagName In TagNames
            ComboBoxCheckTagAccessRead.Items.Add(TagName)
        Next
        If ComboBoxCheckTagAccessRead.Items.Count > 0 Then
            ComboBoxCheckTagAccessRead.SelectedIndex = 0
        End If
    Else
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

C#

private void ButtonCheckTagAccessRead_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxCheckTagAccessRead.Items.Clear();
     string[] TagNames = null;
     string ErrorString = "";
     string[] TagsToCheck = new string[3];
     TagsToCheck[0] = "Ramp.Value";
     TagsToCheck[1] = "Sine.Value";
     TagsToCheck[2] = "Random.Value";
     TagNames = ModuleNetworkNode.OPCSystemsComponent1.CheckTagAccessRead(TextBoxUserNameToCheck.Text, TextBoxPasswordToCheck.Text, TagsToCheck, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString == "Success")
     {
           foreach (string TagName in TagNames)
           {
                  ComboBoxCheckTagAccessRead.Items.Add(TagName);
           }
           if (ComboBoxCheckTagAccessRead.Items.Count > 0)
           {
                  ComboBoxCheckTagAccessRead.SelectedIndex = 0;
           }
     }
     else
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}

CheckTagAccessWrite

The CheckTagAccessWrite Function returns a list of Tags that have write access from the UserName and Password specified.

This method requires Security access for Get Secuirty Parameters from the user and password specified in the LogIn method of the component.

Returns Empty String Array if service is not reachable.

Returns a String Array of Tags that are allowed for Write Access.

UserName is the user to verify with the Tags.

Password is the password of the user to verify with the Tags.

Tags is a list of tags to check in the service, do not include the remote network path in the tag names.

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 ButtonCheckTagAccessWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCheckTagAccessWrite.Click
    Cursor.Current = Cursors.WaitCursor
    ComboBoxCheckTagAccessWrite.Items.Clear()
    Dim TagNames() As String
    Dim TagName As String
    Dim ErrorString As String = ""
    Dim TagsToCheck(2) As String
    TagsToCheck(0) = "Write OPC Output.Value"
    TagsToCheck(1) = "Write String.Value"
    TagsToCheck(2) = "Pump.Value"
    TagNames = ModuleNetworkNode.OPCSystemsComponent1.CheckTagAccessWrite(TextBoxUserNameToCheck.Text, TextBoxPasswordToCheck.Text, TagsToCheck, TextBoxNetworkNode.Text, ErrorString)
    If ErrorString = "Success" Then
        For Each TagName In TagNames
            ComboBoxCheckTagAccessWrite.Items.Add(TagName)
        Next
        If ComboBoxCheckTagAccessWrite.Items.Count > 0 Then
            ComboBoxCheckTagAccessWrite.SelectedIndex = 0
        End If
    Else
        MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End If
End Sub

C#

  

private void ButtonCheckTagAccessWrite_Click(object sender, System.EventArgs e) {
     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
     ComboBoxCheckTagAccessWrite.Items.Clear();
     string[] TagNames = null;
     string ErrorString = "";
     string[] TagsToCheck = new string[3];
     TagsToCheck[0] = "Write OPC Output.Value";
     TagsToCheck[1] = "Write String.Value";
     TagsToCheck[2] = "Pump.Value";
     TagNames = ModuleNetworkNode.OPCSystemsComponent1.CheckTagAccessWrite(TextBoxUserNameToCheck.Text, TextBoxPasswordToCheck.Text, TagsToCheck, TextBoxNetworkNode.Text, ref ErrorString);
     if (ErrorString == "Success")
     {
           foreach (string TagName in TagNames)
           {
                  ComboBoxCheckTagAccessWrite.Items.Add(TagName);
           }
           if (ComboBoxCheckTagAccessWrite.Items.Count > 0)
           {
                  ComboBoxCheckTagAccessWrite.SelectedIndex = 0;
           }
     }
     else
     {
           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
}