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

Get Tag Names

GetTagNames

  • ReferenceGroup is the name of the Group that you want to retrieve the Tags for. Leaving this blank will return all Tags in the Service.
  • NetworkNode is the node you wish to connect to. Leave this blank for localhost.
  • ErrorString will return Success or a message.
  • Returns an array of strings containing the Tag Names for the specified Group.
  • Returns Empty Array if Service is not reachable.
C#
using System;


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

            string[] TagNames = null;
            string ErrorString = "";
            string referenceGroup = "";  
            string networkNode = "";
            TagNames = oasc.GetTagNames(referenceGroup, networkNode, ref ErrorString);
            if (ErrorString == "Success")
            {
                foreach (string TagName in TagNames)
                {
                    Console.WriteLine(TagName);
                }
                if (TagNames.Length == 0)
                {
                    Console.WriteLine("There are no tags in this group.");
                }
            }
            else
            {
                Console.WriteLine(ErrorString);              
            }
        }
    }
}
VB
Imports System

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

        Public Shared Sub Main(ByVal args As String())
            Dim TagNames As String() = Nothing
            Dim ErrorString As String = ""
            Dim referenceGroup As String = ""
            Dim networkNode As String = ""
            TagNames = oasc.GetTagNames(referenceGroup, networkNode, ErrorString)

            If ErrorString = "Success" Then

                For Each TagName As String In TagNames
                    Console.WriteLine(TagName)
                Next

                If TagNames.Length = 0 Then
                    Console.WriteLine("There are no tags in this group.")
                End If
            Else
                Console.WriteLine(ErrorString)
            End If
        End Sub
    End Class
End Namespace

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 node you wish to connect to. Leave this blank for localhost.
  • ErrorString will return Success or a message.
  • RemoteSCADAHostingName is the name of the Live Data Cloud OAS Service to connect to.
C#
using System;

namespace OASDataSample
{
    class Program
    {
        static OASConfig.Config oasc = new OASConfig.Config();
        static void Main(string[] args) 
        {
            string[] TagNames = null;
            string ErrorString = "";
            string referenceGroup = "";  
            string networkNode = "";

            TagNames = oasc.GetAllTagNames(referenceGroup, networkNode, ref ErrorString);
            if (ErrorString == "Success")
            {
                foreach (string TagName in TagNames)
                {
                    Console.WriteLine(TagName);
                }
                if (TagNames.Length == 0)
                {
                    Console.WriteLine("There are no tags in this group.");
                }
            }
            else
            {
                Console.WriteLine(ErrorString);
            }
        }

    }
}
VB
Imports System

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

        Public Shared Sub Main(ByVal args As String())
            Dim TagNames As String() = Nothing
            Dim ErrorString As String = ""
            Dim referenceGroup As String = ""
            Dim networkNode As String = ""
            TagNames = oasc.GetAllTagNames(referenceGroup, networkNode, ErrorString)

            If ErrorString = "Success" Then

                For Each TagName As String In TagNames
                    Console.WriteLine(TagName)
                Next

                If TagNames.Length = 0 Then
                    Console.WriteLine("There are no tags in this group.")
                End If
            Else
                Console.WriteLine(ErrorString)
            End If
        End Sub
    End Class
End Namespace
Back to top Copyright (c) Open Automation Software. All rights reserved.