HTTP API Operations

/gettoken

Used to get an identity token from the server, which will then be used on every subsequent request to read or write data.

message

{
  "un":"<username>",
  "pw":"<password>"
}

response

Unless an error occurs, the gettoken response will always contain a token in the response with a status of “OK“. The token should then be included in every subsequent call to the API, identifying the user context for each request.

If the credentials are not valid, a token will still be created, but depending on the OPCSystems Service configuration, that token may not allow the user to gain access to read or write data.

{
  "message":"<token>",
  "status":"<OK | ERROR>"
}

/getdata

Used to get the most recent tag data from the server for real time data display.

message

The message should contain an array of “tags“, each representing a server tag. Each tag should contain an array of “props“, each representing a distinct property that you would like to retrieve from the server for that tag. For example, if you want to get the value for “Pump.Value“, the tag name would be “Pump“, and it would contain a single property with a name of “Value“.

If you wanted to retrieve both “Pump.Value” and “Pump.Description“, you would send a single tag with two elements in the props collection for “Value” and “Description“, respectively.

{
  "tags":[
    {
      "name":"<tag name>",
      "props":[
        {"name":"<tag property>"},
        ...
      ]
    },
    ...
  ],
  "status":"",
  "message":"",
  "token":"<token>"
}

response

The response follows the same structure as the request, with additional data populated in the property structure. A “datatype” is returned to assist with client-side data formatting, a boolean “quality” field is returned to indicate whether the data quality from the source is good or bad, and the raw value is populated in the “val” field. The value will always be populated as a string no matter which datatype the source is. Use the datatype to do any native client conversions.

{
  "message":"<blank if no error>",
  "status":"<OK | ERROR>",
  "tags":[
    {
      "name":"<tag name>",
      "props":[
        {
          "datatype":"<boolean|string|float|int>",
          "name":"<tag property>",
          "quality":<true | false>,
          "val":"<property value>"
        }
      ]
    },
    ...
  ],
  "token":"<token passed in request>"
}

/setdata

Used to set a tag value on the server, and ultimately on the data source itself. The message is similar to that used in the /getdata operation, with the addition of the “val” field on the property indicating the new value to set on the server.

message

{
  "tags":[
    {
      "name":"<tag name>",
      "props":[
        {
          "name":"<tag property>",
          "val":"<new property value>"
        }
      ]
    }
  ],
  "status":"",
  "message":"",
  "token":"<token>"
}

response

{
  "status":"<OK | ERROR>",
  "message":"",
}

/gettrenddata

Used to retrieve real time and historical alarm data points for rendering graphs and charts on a client.

message

The “requesttype” field determines the type and amount of data returned. For an full load of datapoints, pass an empty string. For only new data received since the last request, pass “NewData”. For historical data, first issue a request with using “HistoryRequest”, and pass in “HistoryData” for subsequent requests for data values.

Only use the “starthistorydate” and “endhistorydate” fields when requesting historical data. Omit these fields for all other requests. Also, these values are based on the Javascript Date format and represent the number of ticks since January 1, 1970, and other client ticks may need conversion.

The “chartinstanceguid” field is used to synchronize between client and server requests. When an initial data set is requested, pass in an empty string, and the server will assign a chartinstanceguid value in the response. For all subsequent messages within the context of that trend data, use the same chartinstanceguid and “NewData” in the requesttype field to reduce the amount of data transferred to the client on each request.

The “samplerate” and “timeframe” fields are used to determine the frequency of samples in seconds, and the timeframe for the full data set.

The “tagnames” array lists each individual tag that will be polled for trend data. These names are simple strings representing the each tag (e.g. “Random.Value”), and the order in which the data will be returned from the server.

The “historytagnames” field is a parallel array to the “tagnames” list. Include a blank entry for each entry in the tagnames array, unless the historical data for any tag is in a separate datalogging group. In that case, use the format datalogginggroupname.fieldname for each entry.

The “historystatprocessing” field is also a parallel array associated with the “tagnames” list. These entries indicate the method used to calculate the historical datapoints returned for each tag. In most cases, use “avg” for an average value of the data samples. You can also use “min” and “max” to get the minimum and maximum values for that data sample timeframe, or “lastsample” to use the most recent sample in that timeframe.

By default, when data is returned, only the raw data values are included in the result, without any timestamp information. When using the averaging method, this makes plotting very straightforward since the timestamp can be inferred from the start time, end time, and number of samples.

It also greatly reduces the amount of data transferred from the server by having the client perform the calculations for display. However, if you wish to include the actual timestamp with each sample, set the “returnalldatawithtimes” value to true.

{
  "token":"<token>",
  "requesttype":"<blank | NewData | HistoryRequest | HistoryData>",
  "chartinstanceguid":"",
  "samplerate":1,
  "timeframe":50,
  "tagnames":[
    "<tag.value>",
    ...
  ],
  "historytagnames":[
    "<datalogginggroupname.fieldname>",
    ...
  ],
  "historystatprocessing":[
    "<avg | min | max | lastsample>",
    ...
  ],
  "starthistorydate" : <ticks>,
  "endhistorydate" : <ticks>,
  "returnalldatawithtimes":false
}

response

The “chartinstanceguid” field is returned to help you coordinate data sets if you are displaying multiple sets with different parameters. The “firsttime” and “lasttime” fields are tick values indicating the timestamp of the first datapoint and last datapoint in the result, respectively, and combined with the “numberofvalues” can be used to generate timestamps for each datapoint.

If the “returnalldatawithtime” field was utilized in the request, then the “timesforreturnalldata” field in the response will contain actual timestamps for each individual datapoint.

The “penvalues” field will contain the raw datapoints. These are arranged in an array for each individual tag requested in the request message’s “tagnames” field. The penvalues are returned in the same order as tags requested.

{
  "chartinstanceguid":"<guid>",
  "firsttime":<ticks>,
  "lasttime":<ticks>,
  "numberofvalues":<int>,
  "penvalues":[
    [ <array of data points> ],
    ...
  ],
  "timesforreturnalldata":[
    [<array of ticks>],
    ...
  ]
  "status":"<OK | ERROR>",
  "message":"",
}

/getalarmdata

Used to retrieve real time and historical alarm data, optionally filtered by group, type, and status.

message

Similar the the gettrenddata request, there is a concept of an instance guid, referenced by the “alarminstanceguid” field. On an initial request using the “requesttype” of “RefreshAllData“, use a blank alarminstanceguid. The response will contain a guid assigned by the server to be used in all subsequent requests to synchronize data and modes between client and server.

The “requesttype” field is used to switch between modes. “RefreshAllData” will pull all current real time alarm data available in a single dataset. This is used to refresh data or get a full update after displaying historical data. Subsequent requests for real time alarms should use “NewData” as it will reduce bandwidth and only provide updated alarms since the last request.

To display historical alarms, send an initial message with a requesttype of “HistoryRequest” along the “starthistorydate” and “endhistorydate” fields containing ticks to define the timeframe for historical data. Then subsequent requests should be issued with the “HistoryData” requesttype to receive the dataset.

The “networknodes” is an array of network node strings used for determining the source of the data. Leave empty to assume “localhost” relative to the OPCSystems Service being contacted.

The “alarmfilter” field is used to determine the criteria for which alarms to include in the resulting dataset.

{
  "alarminstanceguid":"",
  "token":"<token>",
  "requesttype":"<RefreshAllData | NewData | HistoryRequest | HistoryData>",
  "networknodes":[],
  "alarmfilter":{
    "includealarmactive":<true|false>,
    "includealarmactiveacked":<true|false>,
    "includealarmnotactive":<true|false>,
    "includealarmnotactivenotacked":<true|false>,
    "maxpriority":<int>,
    "minpriority":<int>,
    "alarmgroups":[],
    "alarmtypes":[
      "Digital",
      "High",
      "High High",
      "Low",
      "Low Low",
      "ROC",
      "System"
    ]
  },
  "starthistorydate":<ticks>,
  "endhistorydate":<ticks>
}

response

The response for any request for alarms will contain the matching alarminstanceguid, along with an array of “alarmvalues“. Each alarm value itself is an array containing the values for the individual alarms. Use the AlarmID field when referencing any individual alarm for performing an Ack or Delete operation.

{
  "alarminstanceguid":"<guid>",
  "alarmvalues":[
    [
      "<NetworkNode>"
      "<AlarmID>"
      "<AlarmType>"
      "<Group>"
      "<Priority>"
      "<Text>"
      "<Active>"
      "<Acked>"
      "<TimeDelay>"
      "<AlarmValue>"
      "<AlarmLimit>"
      "<ClearedValue>"
      "<AlarmDateTime>"
      "<ClearedDateTime>"
      "<AckedDateTime>"
      "<AckedUser>"
      "<Units>"
      "<Document>"
      "<Comment>"
      "<OKToDelete>"
      "<OKToComment>"
    ],
    ...
  ],
  "message":"",
  "status":"<OK | ERROR>"
}

/updatealarm

Used to update an alarm, marking it as acknowledged or marking it for deletion.

message

Passing in a “requesttype” of “Ack” will mark the alarm identified with “alarmid” as acknowledged, and passing in “Delete” will mark the alarm for deletion.

{
  "token":"<token>",
  "alarmid":"<alarmid>",
  "networknode":"<networknode>",
  "requesttype":"<Ack | Delete>"
}

response

{
  "alarminstanceguid":"<guid>",
  "message":"",
  "status":"<OK | ERROR>"
}

HTTP API JSON Data Structures

Any client that can make HTTP calls using JSON data structures can call the API to perform any of the following functions. All urls are relative to the base OPCSystems Service address with a port designated for the HTTP calls. Urls follow the pattern:

<protocol>://<server>:<port>/OPCREST<operation>

Example:

http://your.server.com:58725/OPCREST/gettoken

The API and client library utilizes the JSONP pattern to allow for greater flexibility in deployment without the need for the OPCSystems Service and the web application to be on the same domain. As such, all calls to the API are HTTP GET commands with UrlEncoded data sent as parameters. The required parameters for all API calls are as follows:

callback : <string>

The JSONP callback name. If not implementing the JSONP pattern in the client itself, this can be any string and will be the function name returned by the server containing the response data.

message : <string>

A UrlEncoded string that is the JSON structure required for the particular request. So if you wanted to pass in the necessary structure for executing a call to gettoken, you would pass the following JSON into the message parameter:

{%22un%22:%22someuser%22,%22pw%22:%22somepassword%22}

So, a full example of a call to an OAS server to execute the gettoken operation would look like the following:

http://your.server.com:58725/OPCREST/gettoken?callback=mycallback&message={%22un%22:%22someuser%22,%22pw%22:%22somepassword%22}

Also following the JSONP pattern, the response will take on the form of a JavaScript function with a single parameter containing the JSON response data. For example, if the request parameter for callback was passed a value of “mycallback”, the response would take the following form:

mycallback(<JSON data>);

So using the full example above, you would get something similar to the following as a response:

mycallback({"message":"94ae2a8e-8c20-4578-88a8-bc8089dedb63","status":"OK"});

HTTP API Overview

NOTE: This is the underlying API used only by the Web HMI, Web Alarm, and Web Trend features. You are free to use this if you want to make some simple calls to the OAS server over HTTP for data, but if you are looking for a more fully-featured API for HTTP access, see the REST API.

Overview – Web User Interface Programming

 

Real-time Data JS Interface

Refer to the Web HMI – Programming Reference for reference and examples of accessing real-time data in a web client using Javascript

Real-time and Historical Trend JS Interface

Refer to the Web Trend – Programming Reference – Web Trend for reference and examples of accessing real-time and historical trend data in a web client using Javascript

Real-time and Historical Alarm JS Interface

Refer to the Web Alarm – Programming Reference –  Web Alarm for reference and examples of accessing real-time and historical alarm data in a web client using Javascript

 

Frequently Asked Questions – Programmatic Interface

After authentication, how long can I use the token and clientid?
The security token and client id granted to the caller after authentication represent a REST API session. As long as the server remains active (not rebooted), and the credentials are continually used, the session will not expire. If there is no activity on the session after 30 minutes, the session will expire and a 401 Unauthorized response will be returned for all operations. This idle timeout can be configured on the server using the OAS Configuration app. Go to Configure > Options, select your OAS server (usually localhost when configuring the current machine) and then go to the Networking tab. Here you can set the REST API Session Timeout in minutes.
How can I programmatically browse OPC Servers?
Yes, using the free to use OPCSystems component. Refer to the WinForm Example Code under the program group Open Automation Software-Example in the Form FormConfigureOPC. This example is also listed in this help file in Programmatic Interface - .NET Programmatic Configuration - Programmatic Access OPC Browsing.

Videos – Programmatic Interface

.NET Data Connector

Connect Visual Studio applications on-premise or over the Internet to live data using the .NET Data Connector, a 100% managed .NET component for asynchronous and synchronous communications.

Realtime Data Access .NET Applications

Demonstration of the OAS Example Service Code and explanation of use of the most common methods.

  • 00:00 – Introduction
  • 00:33 – Source code example
  • 01:07 – Visual studio projects example
  • 01:33 – How to get a visual studio app
  • 01:40 – How to create projects and use visual studio
  • 03:05 – OAS service code example
  • 15:00 – Tag variables
  • 15:37 – How to browse tags
  • 17:10 – Networking
  • 20:55 – How to implement security
  • 21:31 – How to publish
  • 22:15 – How to register service
  • 23:41 – How to change project name
  • 26:20 – Questions
Client Failover

.NET applications can implement an automated or controlled switch to data servers to add redundancy to your application.

View UDI – Videos to create your own OAS Drivers for cross platform deployment with the free Universal Driver Interface SDK.

.NET Realtime Data Access

The .NET Data Connector product provides read and write to realtime tags including data sources of direct drivers to Modbus, Allen Bradley, Siemens, OPC UA Servers, Classic OPC Servers, MQTT, AWS IoT, Azure IoT Data Hub, Microsoft Excel, data from SQL Server, Oracle, Access, mySQL, MongoDB, REST API, and other .NET applications.

Installation of Assemblies

  • All OAS .NET Assemblies are distributed with the OAS Platform and located within the installation directory and subdirectory \Controls\.
  • Optionally, you can install the assembly package from NuGet within Visual Studio
    Direct link to the OASIOT.OASData package: https://www.nuget.org/packages/OASIOT.OASData

Assembly Usage

The OASData.dll assembly is a .NET Standard 2.0 assembly which can be integrated into any .NET application with the following targets.

  • .NET 5 or greater
  • .NET Core 2.0 or greater
  • .NET Framework 4.61 or greater
  • Xamarin.iOS 10.14 or greater
  • Xamarin.Android 8.0 or greater
  • UWP 1.0.0.16299 or greater

The same access can also be provided in the legacy assemblies for Framework 4.6 or less located in the OAS installation directory C:\Program Files\Open Automation Software\OAS\Controls\.
If you are using the OAS WPF HMI product use the OPCWPFDasbhoard.OPCWPFData component.
If you are using the OAS WinForm HMI product use the OPCControls.OPCControlData component.
For .NET Framework 4.6 or less projects without the need for user interface controls use the OPCSystemsDataConnector assembly.

The .NET Data Connector is also a very powerful method to turn any data from a .NET application into a realtime source for the Open Automation Software platform. This is easily done with the WriteTags method which you can optionally specify TimeStamps.

All components have the same easy to use programmatic methods.

Sample Code

The OAS Example Service Code is a working example of reading and writing tags synchronously and asynchronously.  This includes example projects for both C# and VB for .NET Core Console App to run on all operating systems including…

  • Linux
  • Windows
  • Mac
  • Android
  • iOS

There is also C# and VB projects to run as a Windows Service.  The code examples in all 4 projects are the same to show adding tags programmatically and the asynchronous and synchronous methods for reading and writing data.

Applications can be deployed locally or remotely and can optionally implement OAS Basic Networking or Live Data Cloud Networking.

All Tag Variables are accessible for reading and writing.

Examples:

  • TagName.Value
  • TagName.Desription
  • TagName.Units
  • TagName.HighHighAlarmLimit
  • TagName.HighHighAlarmActive (read only)

See a complete list of Tag Variables

Networking

Tag names can include an IP Address, network node name, or registered domain name if the application is deployed remote from the OAS Engine.

Basis Networking Example:

\\192.168.0.1\TagName.Value

If Live Data Cloud networking is implemented for self-hosting with a dynamic IP Address the LDC syntax is applicable.

Live Data Cloud Networking Example:

\\www.opcweb.com\RemoteSCADAHosting.MyLDCNode.TagName.Value

Common Methods

See our OASData documentation for more details.

And also Realtime Data Access – VB and C# – Windows Server and .NET Core Console App examples for programmatic tag creation and realtime data access.

Trend Tags

GetTrendPointGroupNames

  • The GetTrendPointGroupNames Function returns a list of Groups in the specified ReferenceGroup path that contain Tags that are enabled for trending.
  • Returns Empty String if service is not reachable.
  • Returns a String Array of Groups in the ReferenceGroup that have Tags that are enabled for trending.
  • ReferenceGroup is a string of the Group path to retrieve the Groupss 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 ButtonGetTrendPointGroupNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTrendPointGroupNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetTrendPointGroupNames.Items.Clear()
        Dim GroupNames() As String
        Dim GroupName As String
        Dim ErrorString As String = ""
        GroupNames = ModuleNetworkNode.OPCSystemsComponent1.GetTrendPointGroupNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each GroupName In GroupNames
                ComboBoxGetTrendPointGroupNames.Items.Add(GroupName)
            Next
            If ComboBoxGetTrendPointGroupNames.Items.Count > 0 Then
                ComboBoxGetTrendPointGroupNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
 
    End Sub

C#

  private void ButtonGetTrendPointGroupNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetTrendPointGroupNames.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.GetTrendPointGroupNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string GroupName in GroupNames)
                           {
                                  ComboBoxGetTrendPointGroupNames.Items.Add(GroupName);
                           }
                           if (ComboBoxGetTrendPointGroupNames.Items.Count > 0)
                           {
                                  ComboBoxGetTrendPointGroupNames.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
 
              }
 

GetTrendPointTagNames

  • The GetTrendPointTagNames Function returns a list of Tags in the specified ReferenceGroup path that are enabled for trending.
  • Returns Empty String if service is not reachable.
  • Returns a String Array of Tags in the ReferenceGroup that are enabled for trending.
  • 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 ButtonGetTrendPointTagNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTrendPointTagNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetTrendPointTagNames.Items.Clear()
        Dim TagNames() As String
        Dim TagName As String
        Dim ErrorString As String = ""
        TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetTrendPointTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each TagName In TagNames
                ComboBoxGetTrendPointTagNames.Items.Add(TagName)
            Next
            If ComboBoxGetTrendPointTagNames.Items.Count > 0 Then
                ComboBoxGetTrendPointTagNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

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

GetAllTrendPointTagNames

  • The GetAllTrendPointTagNames Function returns a list of all Tags in the specified ReferenceGroup and all sub groups path that are enabled for trending.
  • Returns Empty String if service is not reachable.” + vbCr + “Returns a String Array of Tags in the ReferenceGroup that are enabled for trending.
  • 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 ButtonGetAllTrendPointTagNames_Click(sender As System.Object, e As System.EventArgs) Handles ButtonGetAllTrendPointTagNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetTrendPointTagNames.Items.Clear()
        Dim TagNames() As String
        Dim TagName As String
        Dim ErrorString As String = ""
        TagNames = ModuleNetworkNode.OPCSystemsComponent1.GetAllTrendPointTagNames(TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each TagName In TagNames
                ComboBoxGetTrendPointTagNames.Items.Add(TagName)
            Next
            If ComboBoxGetTrendPointTagNames.Items.Count > 0 Then
                ComboBoxGetTrendPointTagNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
    Private Sub ComboBoxGetTrendPointTagNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetTrendPointTagNames.SelectedIndexChanged
        TextBoxTag.Text = ComboBoxGetTrendPointTagNames.SelectedItem
    End Sub

C#

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

GetTrendPointParameterNames

  • The GetTrendPointParameterNames Function returns a list of Parameters of a Tag in the specified ReferenceGroup path that is enabled for trending.
  • Returns Empty String if service is not reachable.
  • Returns a String Array of Tags in the ReferenceGroup that are enabled for trending.
  • TagName is a string of the tag name to query.
  • 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.

VB

    Private Sub ButtonGetTrendPointParameterNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetTrendPointParameterNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetTrendPointParameterNames.Items.Clear()
        Dim Parameters() As String
        Dim Parameter As String
        Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetTrendPointParameterNames(TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text)
        For Each Parameter In Parameters
            ComboBoxGetTrendPointParameterNames.Items.Add(Parameter)
        Next
        If ComboBoxGetTrendPointParameterNames.Items.Count > 0 Then
            ComboBoxGetTrendPointParameterNames.SelectedIndex = 0
        End If
 
    End Sub

C#

  private void ButtonGetTrendPointParameterNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetTrendPointParameterNames.Items.Clear();
                     string[] Parameters = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Parameter = null;
                     Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetTrendPointParameterNames(TextBoxTag.Text, TextBoxReferenceGroup.Text, TextBoxNetworkNode.Text);
                     foreach (string Parameter in Parameters)
                     {
                           ComboBoxGetTrendPointParameterNames.Items.Add(Parameter);
                     }
                     if (ComboBoxGetTrendPointParameterNames.Items.Count > 0)
                     {
                           ComboBoxGetTrendPointParameterNames.SelectedIndex = 0;
                     }
 
              }

GetDataLoggingNames

  • The GetDataLoggingNames Function returns a list of the Data Logging Groups.
  • 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.

VB

    Private Sub ButtonGetDataLoggingNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetDataLoggingNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetDataLoggingNames.Items.Clear()
        Dim Groups() As String
        Dim Group As String
        Groups = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingNames(TextBoxNetworkNode.Text)
        For Each Group In Groups
            ComboBoxGetDataLoggingNames.Items.Add(Group)
        Next
        If ComboBoxGetDataLoggingNames.Items.Count > 0 Then
            ComboBoxGetDataLoggingNames.SelectedIndex = 0
        End If
    End Sub
 
    Private Sub ComboBoxGetDataLoggingNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetDataLoggingNames.SelectedIndexChanged
        TextBoxDataLoggingGroup.Text = ComboBoxGetDataLoggingNames.SelectedItem
    End Sub
    

C#

 private void ButtonGetDataLoggingNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetDataLoggingNames.Items.Clear();
                     string[] Groups = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Group = null;
                     Groups = ModuleNetworkNode.OPCSystemsComponent1.GetDataLoggingNames(TextBoxNetworkNode.Text);
                     foreach (string Group in Groups)
                     {
                           ComboBoxGetDataLoggingNames.Items.Add(Group);
                     }
                     if (ComboBoxGetDataLoggingNames.Items.Count > 0)
                     {
                           ComboBoxGetDataLoggingNames.SelectedIndex = 0;
                     }
              }
 
              private void ComboBoxGetDataLoggingNames_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxDataLoggingGroup.Text = ComboBoxGetDataLoggingNames.SelectedItem.ToString();
              }

GetHistoryTagNames

  • The GetHistoryTagNames Function returns a list of Field Names in the Data Logging Group.
  • Returns Empty String if service is not reachable.
  • Returns a String Array of Field Names in the Data Logging Group.
  • Group is a string of the Data Logging Group path to retrieve the Field Names 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 ButtonGetHistoryTagNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetHistoryTagNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetHistoryTagNames.Items.Clear()
        Dim FieldNames() As String
        Dim FieldName As String
        Dim ErrorString As String = ""
        FieldNames = ModuleNetworkNode.OPCSystemsComponent1.GetHistoryTagNames(TextBoxDataLoggingGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each FieldName In FieldNames
                ComboBoxGetHistoryTagNames.Items.Add(FieldName)
            Next
            If ComboBoxGetHistoryTagNames.Items.Count > 0 Then
                ComboBoxGetHistoryTagNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

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

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);
     }
}

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();
              }