# Creating a UDT to display device status for each view in Perspective

**URL:** <https://forum.inductiveautomation.com/t/creating-a-udt-to-display-device-status-for-each-view-in-perspective/75803>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 30, 2023, 10:26pm UTC](https://forum.inductiveautomation.com/t/creating-a-udt-to-display-device-status-for-each-view-in-perspective/75803 "2023-06-30T22:26:44Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2023, 1:06am UTC](https://forum.inductiveautomation.com/t/creating-a-udt-to-display-device-status-for-each-view-in-perspective/75803/4 "2023-07-01T01:06:16Z")

</div>

> [@nminchin](#):
>
> too long to explain/get me started?

See this recent topic:

> [@How to trigger a gateway timer to trigger immediately but no more than four times per minute?](https://forum.inductiveautomation.com/t/how-to-trigger-a-gateway-timer-to-trigger-immediately-but-no-more-than-four-times-per-minute/75476/7):
>
> I usually use this construct at the top level of a script module: from java.util.concurrent import LinkedBlockingDeque, TimeUnit # Capacity = 100. The new instance is thrown away if already in globals. deque = system.util.getGlobals().setdefault('MySpecialForeverQueue', LinkedBlockingDeque(100)) def someTimerEvent(event): next = deque.poll(15000, TimeUnit.MILLISECONDS) if next: # handle it # Run the above at a fixed \*\*rate\*\* matching the poll timeout. Use [ConcurrentLinkedDeque](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ConcurrentLinkedDeque.html) if you do…

> [@nminchin](#):
>
> inefficient to constantly define a function

This, unless you really need a closure for a short function, but

> [@nminchin](#):
>
> Or are there other reasons?

Many event scripts have legacy scope rules that prevent `def` from pulling in any top level variables in that script into the function scope. Move such to project library scripts. (That's why you see `import system` in functions `def`'d in those scopes.)

---

_[View the full topic](https://forum.inductiveautomation.com/t/creating-a-udt-to-display-device-status-for-each-view-in-perspective/75803)._
