# Log OPC tag on-change of another and on the hour

**URL:** <https://forum.inductiveautomation.com/t/log-opc-tag-on-change-of-another-and-on-the-hour/41982>\
**Category:** Ignition\
**Created:** [January 5, 2021, 8:46pm UTC](https://forum.inductiveautomation.com/t/log-opc-tag-on-change-of-another-and-on-the-hour/41982 "2021-01-05T20:46:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 5, 2021, 8:46pm UTC](https://forum.inductiveautomation.com/t/log-opc-tag-on-change-of-another-and-on-the-hour/41982/1 "2021-01-05T20:46:50Z")

</div>

My machine’s cycle count increases forever (and doesn’t reset at end of shift / batch). I want to graph the cycle count by shift with each shift starting at zero.

![Shift chart](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a579ff7236920fbafc5c8c7ff7b504c4b114954.png)

To do this efficiently I think I need to

1. Log the count on each change of the RUN status. (That will give me each of the corner points on my graph.)
2. At shift start / end or hourly. I can then use a script transform on the chart binding to run through the dataset and subtract the shift-start cycle-count from each value.

I know how to create an expression tag that will turn on for a minute at a certain time and how to use this as a one-shot on a transaction group.

```auto
//Turn on for one minute at 00, 15, 30 and 45 past the hour.
dateExtract(now(0), "minute") = 0
|| dateExtract(now(0), "minute") = 30

```

How best would I also capture the cycle counts on-change of run status? Should I set up a second transaction group for that? Or is there a much better way?
