# UDT instance counter from alarm script

**URL:** <https://forum.inductiveautomation.com/t/udt-instance-counter-from-alarm-script/92717>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [July 2, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/udt-instance-counter-from-alarm-script/92717 "2024-07-02T21:06:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DdP](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@DdP](https://forum.inductiveautomation.com/u/DdP)\
**Post date:** [July 2, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/udt-instance-counter-from-alarm-script/92717/1 "2024-07-02T21:06:57Z")

</div>

Hi all,

I am have a project with a machine UDT that has alarms and I need to total 5 of those alarms and reset the count at midnight everyday.

each instance uses a parameter called machineName which would be ATX0504 in the picture below. I have added the tag that would increment the count tag when it goes active. The read- and writeblocking works when I use the exact same syntax with the direct tag, I am not certain how to pass the instance parameter into the UDT alarm script.

thanks.

 ![Screenshot 2024-07-03 085814](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90fecda2a8d0eeed1a77b6d6cc0a7783e008b355.png)

---

<div class="post-metadata">

**Author:** ![DdP](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@DdP](https://forum.inductiveautomation.com/u/DdP)\
**Post date:** [July 16, 2024, 9:37pm UTC](https://forum.inductiveautomation.com/t/udt-instance-counter-from-alarm-script/92717/2 "2024-07-16T21:37:26Z")

</div>

For anyone wanting to do something similar. the script below works using tag directory and paths.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/86d86da613994e796c7e81a8dec19f4792ced678.png)
