Loading API Index...
Open Automation Software API Documentation
Show / Hide Table of Contents

Add or Remove Tags

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.
C#
using System;


namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            Int32 ResultInt32 = 0;
            string tagName = "";
            string referenceGroup = "";
            string networkNode = "";
            string ErrorString = "";
            string outMess = "";
            ResultInt32 = oasc.AddTag(tagName, referenceGroup, networkNode, ref ErrorString);
            if (ResultInt32 == -1)
            {
                outMess = "OAS Service not reached.";
            }
            else if (ResultInt32 == 1)
            {
                outMess = "Tag successfully added.";
            }
            else
            {
                outMess = ErrorString;
            }

            Console.WriteLine(outMess);
        }

    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            Dim ResultInt32 As Int32 = 0
            Dim tagName As String = ""
            Dim referenceGroup As String = ""
            Dim networkNode As String = ""
            Dim ErrorString As String = ""
            Dim outMess As String = ""
            ResultInt32 = oasc.AddTag(tagName, referenceGroup, networkNode, ErrorString)

            If ResultInt32 = -1 Then
                outMess = "OAS Service not reached."
            ElseIf ResultInt32 = 1 Then
                outMess = "Tag successfully added."
            Else
                outMess = ErrorString
            End If

            Console.WriteLine(outMess)
        End Sub
    End Class
End Namespace

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.
C#
using System;


namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            Int32 ResultInt32 = 0;
            string tagName = "";
            string referenceGroup = "";
            string networkNode = "";
            string ErrorString = "";
            string outMess = "";
            ResultInt32 = oasc.RemoveTag(tagName, referenceGroup, networkNode, ref ErrorString);
            if (ResultInt32 == -1)
            {
                outMess = "OAS Service not reached.";
            }
            else if (ResultInt32 == 1)
            {
                outMess = "Tag successfully removed.";
            }
            else
            {
                outMess = ErrorString;
            }

            Console.WriteLine(outMess);
        }

    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            Dim ResultInt32 As Int32 = 0
            Dim tagName As String = ""
            Dim referenceGroup As String = ""
            Dim networkNode As String = ""
            Dim ErrorString As String = ""
            Dim outMess As String = ""
            ResultInt32 = oasc.RemoveTag(tagName, referenceGroup, networkNode, ErrorString)

            If ResultInt32 = -1 Then
                outMess = "OAS Service not reached."
            ElseIf ResultInt32 = 1 Then
                outMess = "Tag successfully removed."
            Else
                outMess = ErrorString
            End If

            Console.WriteLine(outMess)
        End Sub
    End Class
End Namespace

DeleteAllTags

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.
C#
using System;


namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args)
        {

            Int32 ResultInt32 = 0;
            string networkNode = "";
            string ErrorString = "";
            string outMess = "";
            ResultInt32 = oasc.DeleteAllTags(networkNode, ref ErrorString);
            if (ResultInt32 == 1)
            {
                outMess = "All Tags successfully removed.";
            }
            else
            {
                outMess = ErrorString;
            }

            Console.WriteLine(outMess);
        }

    }
}
VB
Imports System

Namespace OASDataSample
    Class Program
        Shared oasc As OASConfig.Config = New OASConfig.Config()

        Public Shared Sub Main(ByVal args As String())
            Dim ResultInt32 As Int32 = 0
            Dim networkNode As String = ""
            Dim ErrorString As String = ""
            Dim outMess As String = ""
            ResultInt32 = oasc.DeleteAllTags(networkNode, ErrorString)

            If ResultInt32 = 1 Then
                outMess = "All Tags successfully removed."
            Else
                outMess = ErrorString
            End If

            Console.WriteLine(outMess)
        End Sub
    End Class
End Namespace
Back to top Copyright (c) Open Automation Software. All rights reserved.