# Is there any way to get the OPC connection names dynamically

**URL:** <https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628>\
**Category:** Ignition\
**Created:** [June 26, 2014, 7:59pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628 "2014-06-26T19:59:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [June 26, 2014, 7:59pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/1 "2014-06-26T19:59:39Z")

</div>

Is there any way to get the OPC connection names dynamically, i didn’t see any functions in the manual. Thanks

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [June 26, 2014, 10:39pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/2 "2014-06-26T22:39:03Z")

</div>

Try the [IALabs Scripting Module](http://www.inductiveautomation.com/forum/viewtopic.php?p=37950#p37950): system.opc.browse

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [June 27, 2014, 6:00pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/3 "2014-06-27T18:00:45Z")

</div>

That’s awesome, just what i thought I needed!

I need a list of OPC Server names, any suggestions where or if I can get those? Thanks again

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [June 27, 2014, 6:13pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/4 "2014-06-27T18:13:24Z")

</div>

FWIW, the IALabs Scripting Module functions are built in to Ignition 7.7.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [June 27, 2014, 6:25pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/5 "2014-06-27T18:25:03Z")

</div>

Hi kathy,

Is there a way I could get the OPC server names dynamically? Thanks

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 7, 2014, 9:57pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/6 "2014-07-07T21:57:32Z")

</div>

Seems like example 1 in the docs for system.opc.browse() does this…

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [July 22, 2014, 6:13pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/7 "2014-07-22T18:13:57Z")

</div>

you have to specify the OPC server to browse with system.opc.browse(opcServer, device, folderPath, opcItemPath) according to the docs. I wanted a list of all current OPC Servers available. Thanks

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [July 22, 2014, 6:30pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/8 "2014-07-22T18:30:04Z")

</div>

Sometimes parameters to a function or method in computer programming are optional. While the [documentation](http://files.inductiveautomation.com/modulemarket/1/46/version/121/doc/system_opc_browse.htm) may be a little lacking in saying that it is optional, you can easily see in the first example that it is optional. Just try it out:

Example 1: Browse every OPC server

```auto
tags = system.opc.browse()
for row in tags:
    print row.getOpcServer(), row.getOpcItemPath(), row.getType(), row.getDisplayName(), row.getDisplayPath(), row.getDataType()
```

UPDATE: Here’s the code to get the list of unique servers:

```auto
tags = system.opc.browse()
servers = []
for row in tags:
    server = row.getOpcServer()
    if server not in servers:
        servers.append(server)
print servers
```

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [July 22, 2014, 8:54pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/9 "2014-07-22T20:54:07Z")

</div>

I saw that thanks, but when i try example 1 i get an error: CANNOT BROWSE, SERVER IS FAULTED. The problem is, none of my OPC servers are faulted.

pretty weird

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [July 22, 2014, 9:10pm UTC](https://forum.inductiveautomation.com/t/is-there-any-way-to-get-the-opc-connection-names-dynamically/8628/10 "2014-07-22T21:10:45Z")

</div>

I had no problem copy/pasting example 1 this morning. You might try contacting tech support to see why you’re having issues.
