# Top of the hour transaction group trigger

**URL:** <https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965>\
**Category:** Ignition\
**Created:** [March 4, 2013, 10:21pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965 "2013-03-04T22:21:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Curlyandshemp](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Curlyandshemp](https://forum.inductiveautomation.com/u/Curlyandshemp)\
**Post date:** [March 4, 2013, 10:21pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/1 "2013-03-04T22:21:47Z")

</div>

What be the best way to have a transaction group trigger at the top of every hour, ie 12:00 13:00. …etc 24 hours a day 7 days a week?

Currently I am using an expression that is looking at the system clock and using a a limit test for time between XX:XX:XX - (XX:XX:XX + 10 seconds) and set the trigger to a non-zero value. Oustide the limit the trigger is set back to 0. For 24 hours , i have 24 limit tests, there has to be a better way.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 4, 2013, 11:18pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/2 "2013-03-04T23:18:57Z")

</div>

A one second timer that checks the current time to see if the hour has change from the last time it checked?

Ideally we should be able to say “run this script at this time”. If we can’t, we should be adding a feature request.

---

<div class="post-metadata">

**Author:** ![Curlyandshemp](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Curlyandshemp](https://forum.inductiveautomation.com/u/Curlyandshemp)\
**Post date:** [March 4, 2013, 11:57pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/3 "2013-03-04T23:57:27Z")

</div>

[quote=“Robert”]A one second timer that checks the current time to see if the hour has change from the last time it checked?

Ideally we should be able to say “run this script at this time”. If we can’t, we should be adding a feature request.[/quote]

Robert,  
thanks for that, but if the system clock is changed +/- 1 hour, a trigger will happen. So far this is the only way I could figure out how to do it:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fbd23e8dba50ef0c0d4c1206eee8d5dfbf573e90.jpg)

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.inductiveautomation.com/u/Ivan)\
**Post date:** [March 5, 2013, 2:58pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/4 "2013-03-05T14:58:59Z")

</div>

Why not use a schedule (instead of a timer) with times:“0-24” and a 1 hour rate?

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 5, 2013, 8:29pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/5 "2013-03-05T20:29:24Z")

</div>

Hi Curly,

How does your method prevent a missing/extra run when the clock changes?

solution: use GMT to trigger. (just thought of this 🙂 )

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [March 5, 2013, 10:41pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/6 "2013-03-05T22:41:07Z")

</div>

Ivan’s suggestion is what I was going to say, use the schedule mode. One interesting small nuance of that mode is that it aligns the execution to a rate multiple of the starting time. In other words, if you do it as he suggested, it will be top of the hour.

If you’re using an older version that doesn’t have that mode, I’d just create a run always expression item, set the expression to “dateExtract(now(), “hour”)”, and set up an “on change” trigger on that item.

Regards,

---

<div class="post-metadata">

**Author:** ![Curlyandshemp](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Curlyandshemp](https://forum.inductiveautomation.com/u/Curlyandshemp)\
**Post date:** [March 5, 2013, 11:38pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/7 "2013-03-05T23:38:46Z")

</div>

[quote=“Colby.Clegg”]Ivan’s suggestion is what I was going to say, use the schedule mode. One interesting small nuance of that mode is that it aligns the execution to a rate multiple of the starting time. In other words, if you do it as he suggested, it will be top of the hour.

If you’re using an older version that doesn’t have that mode, I’d just create a run always expression item, set the expression to “dateExtract(now(), “hour”)”, and set up an “on change” trigger on that item.

Regards,[/quote]

Colby,  
excuse me for being a dummy, but can you post how I should alter my transaction group trigger to the method suggested?

Thanks

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [March 6, 2013, 8:04pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/8 "2013-03-06T20:04:37Z")

</div>

Hi,

Here’s the schedule settings I was suggesting:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/493e152bcea0257bdae63437683f5d6c52f00e69.png)

However, if your version of the sqlbridge doesn’t have the schedule option (I forget exactly when it was added, 7.4?), this could work too:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c43d7a957cfcf33a62419121678dcb1afedac3e6.PNG)  
  
In that case, you would just need your group to run at a 1 second rate or so.

Regards,

---

<div class="post-metadata">

**Author:** ![Curlyandshemp](https://avatars.discourse-cdn.com/v4/letter/c/bcef8e/32.png) [@Curlyandshemp](https://forum.inductiveautomation.com/u/Curlyandshemp)\
**Post date:** [March 6, 2013, 11:10pm UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/9 "2013-03-06T23:10:43Z")

</div>

Excellent!

Thanks for this. This customer’s app is V7.2.11 so it does not have that feature you mentioned. I will implement and test tomorrow.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 7, 2013, 10:33am UTC](https://forum.inductiveautomation.com/t/top-of-the-hour-transaction-group-trigger/5965/10 "2013-03-07T10:33:31Z")

</div>

Mine is similar to Colby’s, but looking at the minutes. It’s not susceptible to DST changes.

This will return a 1 when the minute is at 0

```auto
!toBoolean(dateextract(now(),"minute"))
```
