Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

OpcDaListServers

  • Last UpdatedOct 29, 2026
  • 2 minute read

OpcDAListServers is a built-in function that browses an OPC server host computer, returns the number of OPC DA server URLs found, and stores their values in an array tag.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

OpcDAListServers

File

Synchronous

No

Supported (Server Only, see "Notes")

Not supported

Not supported

Not supported

Not supported

Syntax

OpcDAListServers( tagServers, "optStrHostName", optNumSpec, "optStrUserName", "optStrPassWord" )

OpcXMLDAListServers replicates the functionality of the OPC DA ConnectionServer Connection dialog, so field names from that dialog are referenced in the appropriate parameter descriptions below. See that topic for more information.

tagServers

This is a string array tag that will receive the URL of each OPC Server found.

Tip: The array should be large enough to hold all of the OPC Servers found. If there are more OPC Servers than the array size, the function will stop at the last array tag and return the array size instead of the actual number of OPC Servers, along with not capturing the URLs of the remaining OPC Servers.

optStrHostName

This optional string parameter contains the Host Name for the OPC server. If unspecified, the default value of "localhost" is used. A static string value must be enclosed in quotes as shown in the syntax and the example. A string tag may be used; the tag name should not be enclosed in quotes.

optNumSpec

This numeric value is the OPC Specification used by the OPC server, according to the table below. If unspecified, the default value of 0 (Data Access 2.xx) is used. A real or integer tag may be used here. Neither a static number nor tags need quotes.

Value

Description

0

Data Access 2.xx (default)

1

Data Access 3.xx

optStrUserName

optStrPassWord

These optional string parameters are the login credentials for for the selected OPC server. A static string value must be enclosed in quotes as shown in the syntax and the example. A string tag may be used; the tag name should not be enclosed in quotes.

Returned value

Value

Description

1+

Success; the positive number is the number of OPC server URLs found on the computer host.

-1

Failure; the function parameters are incorrect.

Notes

This function can be executed only on the project server, where the Edge HMI development environment must be installed and running with at least a Runtime license. You can use the functions StartTask, EndTask, and IsTaskRunning with the parameter "Studio" to programmatically control the development environment.

Examples

Using static values with no assumed defaults:

OpcDAListServers(sArrayOpcUrl, "localhost", 0, "drAirShield", "12345")

Using tags with no assumed defaults:

OpcDAListServers(sArrayOpcUrl, sHostname, iOpcSpec, sUserName, sPassword)

Using all defaults:

OpcDAListServers(sArrayOpcUrl)

In This Topic
Related Links