# Logging Boolean Tag

**URL:** <https://forum.inductiveautomation.com/t/logging-boolean-tag/93866>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 29, 2024, 7:59pm UTC](https://forum.inductiveautomation.com/t/logging-boolean-tag/93866 "2024-07-29T19:59:41Z")\
**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 29, 2024, 10:09pm UTC](https://forum.inductiveautomation.com/t/logging-boolean-tag/93866/4 "2024-07-29T22:09:56Z")

</div>

No, with a retentive timer, you would write PLC logic to move the final time value into a separate tag at the end of the day, followed by the zeroing operation (in one scan in the PLC). At some short time after that (using schedule for the transaction group), you would record the separate tag to your database, using the boundary as the timestamp.

If you don't want to use a timer in the PLC, and you only have a boolean tag brought to Ignition, you should record every transition to the database. (Triggering the transaction group on change of the boolean, or using a simple tag change event script.) This latter will need followup computations with your DB's `lead()` function to assemble the durations per day.

Another option would be to use a retentive timer in the PLC that **never resets**. (You'd have it roll over like an odometer instead.) In Ignition, you'd record its value at the top of every hour, or every five minutes, or some other desired granularity. Then you can easily compute deltas from row to row at any recording granularity.

More reading:

> [@Historicizing running time](https://forum.inductiveautomation.com/t/historicizing-running-time/75853/2):
>
> The least DB storage is to simply record the value every time it changes. You can use a database's lead() or lag() window functions to convert these to durations, trim them to desired time periods, and handle duplicate records (such as those triggered by system restarts). This method does require a reliable connection to the PLC, and ensuring that Ignition runs any time the machine is running. (If you use Ignition's historian to capture these events, you will need to post-process queried hist…

---

_[View the full topic](https://forum.inductiveautomation.com/t/logging-boolean-tag/93866)._
