# More then a minute without recording

**URL:** <https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920>\
**Category:** Ignition\
**Created:** [June 9, 2010, 6:41pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920 "2010-06-09T18:41:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 9, 2010, 6:41pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/1 "2010-06-09T18:41:21Z")

</div>

We record some data once a minute. I need to set up an alert that will go out when data is not recorded for more then a minute.

Example:

Look at time stamp of last record if more then 2 minutes ago send alert.

Can I use script or code here to subtract 2 minutes from current time stamp to verify?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [June 9, 2010, 6:49pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/2 "2010-06-09T18:49:44Z")

</div>

You can create an Expression SQLTag or Expression Item in a group that is a SQL query looking for that lapse and alert on it. What database are you using so I can post an example?

---

<div class="post-metadata">

**Author:** ![dep05d](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dep05d](https://forum.inductiveautomation.com/u/dep05d)\
**Post date:** [June 9, 2010, 8:44pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/3 "2010-06-09T20:44:37Z")

</div>

If you are using a transaction group, you could create a DateTime DB tag, then add it as a read-only item to the group (read-only in this case only means it doesn’t get inserted into the database; they can be written to). Next, add a DateTime expression item (triggered if the group itself is triggered) with an expression of “now()” that writes to the read-only db tag item (under the expression items general properties, under Target Type, select other tag). The tag will then always hold the DateTime of the last group run. You can check that and alarm off of it using a DateDiff expression (might need another tag, I’m not sure off the top of my head if you can alarm on an expression itself).

Hope this helps,

Dan

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 10, 2010, 11:24am UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/4 "2010-06-10T11:24:34Z")

</div>

Travis,

We are using MySQL.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [June 10, 2010, 3:26pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/5 "2010-06-10T15:26:09Z")

</div>

Ok, so your SQL query will look something like`SELECT TIMESTAMPDIFF(MINUTE, t_stamp, CURRENT_TIMESTAMP) >= 2 FROM HistoryTable ORDER BY t_stamp DESC LIMIT 1`When this value goes to 1 you can alert on it. Hope this helps.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 10, 2010, 6:36pm UTC](https://forum.inductiveautomation.com/t/more-then-a-minute-without-recording/1920/6 "2010-06-10T18:36:46Z")

</div>

Travis,

Thanks, I will get to playing with that more in the next couple days.

Jim
