# Resettable runtime counter

**URL:** <https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [June 3, 2024, 4:50pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299 "2024-06-03T16:50:16Z")\
**Posts on this page:** 13\
**Page:** 2

<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:** [September 13, 2024, 7:46pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/22 "2024-09-13T19:46:28Z")

</div>

I just noticed that you changed the provider in all your tag paths to `[~]` where I recommended `[.]`. Are your tags in the root of a provider, or in a folder?

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:01pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/23 "2024-09-13T20:01:38Z")

</div>

They are in default. I changed it back to [.] and it is still not working.

Can you clarify what .after does? I can’t find documentation for it

---

<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:** [September 13, 2024, 8:02pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/24 "2024-09-13T20:02:26Z")

</div>

It is method of `java.util.Date`, which is what Ignition uses for its datetime objects.

[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Date.html#after(java.util.Date)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Date.html#after(java.util.Date))

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:03pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/25 "2024-09-13T20:03:10Z")

</div>

Is the if statement just comparing if offTS \< onTS? and vice versa in the If NOT

---

<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:** [September 13, 2024, 8:04pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/26 "2024-09-13T20:04:31Z")

</div>

`>`, but yeah.

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/27 "2024-09-13T20:06:35Z")

</div>

Any ideas why this is not working still then? I had it working on my virtual machine many months ago, but now in the actual gateway I can’t get it going

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:11pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/28 "2024-09-13T20:11:52Z")

</div>

I changed the tag path to [default] and now getting this. It only appears when the tag is off. When the bool is on, no errors

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/3/c3ece27cdeb628e0704b8e30bcc991739cb1a8bd.jpeg)

---

<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:** [September 13, 2024, 8:14pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/29 "2024-09-13T20:14:59Z")

</div>

There's an extra opening square bracket in the writeBlocking.

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:15pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/30 "2024-09-13T20:15:48Z")

</div>

Wow it is working now, Such a headache for an easy fix. Thanks

---

<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:** [September 13, 2024, 8:17pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/31 "2024-09-13T20:17:27Z")

</div>

In the future, please paste code and errors as text, not screenshots, using the "Preformatted text" button in the forum's comment editor. That helps us find little things more easily.

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 13, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/32 "2024-09-13T20:43:26Z")

</div>

Apologies, the gateway is not internet connected so it makes it a little more difficult. Thanks again

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [September 16, 2024, 1:37pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/33 "2024-09-16T13:37:29Z")

</div>

Runtime counters really should be in the PLC. If you want a "resettable" one add a button to store the current runtime total and display the difference between the stored one and the current one. You could even go so far as to have an array of the last couple reset totals. No need to reinvent the wheel.

As for manual entry to update the runtime from time to time I would make a protected field with a confirmation popup to change the total. This should also write all of the resettables to that new total value.

---

<div class="post-metadata">

**Author:** ![Austin\_Allen](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Austin\_Allen](https://forum.inductiveautomation.com/u/Austin_Allen)\
**Post date:** [September 16, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299/34 "2024-09-16T15:00:04Z")

</div>

Agreed, I wouldn't ever design a system to store the runtime counter in the HMI. However, this is an old SMAR PLC, that I did not have a valid copy of and the tag names/descriptions are not stored in the PLC. Also do not have much experience working in SMAR.

They had the original runtime counter in a NI-Lookout system that bit the dust, hence the upgrade to Ignition. Being that the system is live and I don't have the knowledge with SMAR, opted to keep the runtime counter in the HMI

[Previous page](https://forum.inductiveautomation.com/t/resettable-runtime-counter/91299.md?page=1)
