# Any ideas on how I can search for an Ip address (on a client window) among all of my OPC devices connected?

**URL:** <https://forum.inductiveautomation.com/t/any-ideas-on-how-i-can-search-for-an-ip-address-on-a-client-window-among-all-of-my-opc-devices-connected/26450>\
**Category:** General Discussion\
**Created:** [July 10, 2019, 7:52pm UTC](https://forum.inductiveautomation.com/t/any-ideas-on-how-i-can-search-for-an-ip-address-on-a-client-window-among-all-of-my-opc-devices-connected/26450 "2019-07-10T19:52:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [July 10, 2019, 7:52pm UTC](https://forum.inductiveautomation.com/t/any-ideas-on-how-i-can-search-for-an-ip-address-on-a-client-window-among-all-of-my-opc-devices-connected/26450/1 "2019-07-10T19:52:41Z")

</div>

Any ideas on how I can search for an Ip address (on a client window) among all of my OPC devices connected? Any built-in script functions that would allow me to design a window that searches all of the ip addresses from all of my OPC devices and give the result as the Device name?

I have Ignition 7.9.6

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 11, 2019, 3:57pm UTC](https://forum.inductiveautomation.com/t/any-ideas-on-how-i-can-search-for-an-ip-address-on-a-client-window-among-all-of-my-opc-devices-connected/26450/2 "2019-07-11T15:57:11Z")

</div>

I don’t exactly remember when getDeviceHostName was implemented but I have it on 7.9.9

```python
def findDevice(hostIn):
	data = system.device.listDevices()
	deviceList = data.getColumnAsList(data.getColumnIndex("Name"))
	hostList = [system.device.getDeviceHostname(device) for device in deviceList]
	try:
		index = hostList.index(hostIn)
		return deviceList[index]
	except ValueError:
		return 'host not found'
		
host = '192.168.140.241'

print findDevice(host)

```

If this is something you’ll be doing a lot, I’d recommend using a gateway timer script to collate everything into a dataset memory tag every so often, then use a lookup exression in the client.

```python
# Gateway Timer Script
data = system.device.listDevices()
deviceList = data.getColumnAsList(data.getColumnIndex('Name'))
hostList = [system.device.getDeviceHostname(device) for device in deviceList]

dataOut = system.dataset.addColumn(data, hostList, 'Hostname', str)

system.tag.write('[default]path/to/dataset/tag', dataOut)

```

Expression example:

```auto
lookup({path/to/dataset/tag}, hostnameToLookUp, 'Host not found', 'Hostname', 'Name')
```

---

<div class="post-metadata">

**Author:** ![Lalillo1](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lalillo1](https://forum.inductiveautomation.com/u/Lalillo1)\
**Post date:** [July 11, 2019, 4:05pm UTC](https://forum.inductiveautomation.com/t/any-ideas-on-how-i-can-search-for-an-ip-address-on-a-client-window-among-all-of-my-opc-devices-connected/26450/3 "2019-07-11T16:05:54Z")

</div>

I’ll give it a try. I really appreciate your help. Thank you very much.
