# Report Trigger every 30 min

**URL:** <https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523>\
**Category:** Ignition\
**Created:** [January 5, 2017, 9:25pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523 "2017-01-05T21:25:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [January 5, 2017, 9:25pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/1 "2017-01-05T21:25:31Z")

</div>

Looking for a way to trigger a report every 30 min after a bool goes true.

Right now I just have an expression tag with this script :  
(dateFormat(now(),“mm”)=“30”) || (dateFormat(now(),“mm”)=“00”)

but this will run the report every half hour what I need is if the Bool goes true @ 3:23pm I need the memory tag to execute at 3:53pm then again @ 4:23pm instead of waiting till 4:00pm and 4:30pm

I then have a gateway tag change script that will do the system.report.executeAndDistribute

Any help would be appreciated.

---

<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:** [January 6, 2017, 12:22pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/2 "2017-01-06T12:22:02Z")

</div>

Here’s one way. This sample UDT has four tags.

Enable: Boolean to enable/disable report generation.  
MinutesA: Integer that stores the minutes of when Enable changed `dateExtract({[.]Enable.LastChange},"minute")`  
MinutesB: 30 minute offset from MinutesA

```auto
({[.]MinutesA}+30) % 60
```

Report Trigger: Boolean used to generate the report

`(dateExtract(now(),"minute")={[.]MinutesA} || dateExtract(now(),"minute")={[.]MinutesB}) &&
{[.]Enable}`

You could combine everything into one expression and skip the MinutesA and MinutesB tags, but I think its important to see what those values are.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [January 6, 2017, 1:26pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/3 "2017-01-06T13:26:50Z")

</div>

Jordan - Thanks for the help.

I knew it had to be something like this but just didn’t know how to go about it. The trick that I didn’t know was the Enable.LastChange - that was the missing piece I did not know existed.

Thanks again works perfect.

---

<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:** [January 6, 2017, 4:02pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/4 "2017-01-06T16:02:04Z")

</div>

Here’s an updated one that will let you pick any arbitrary interval in minutes.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [January 12, 2017, 6:14pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/5 "2017-01-12T18:14:28Z")

</div>

Jordan - Thanks again.

Only issue I am having now is I am using a gateway tag change script to execute my report - but it creates two reports for the OnTrue and OnFalse - Is there a way to only execute code in the tag change script when it goes OnTrue?

I am used to WW programming that has an option for OnTrue and OnFalse inside the script editor.

---

<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:** [January 12, 2017, 6:30pm UTC](https://forum.inductiveautomation.com/t/report-trigger-every-30-min/12523/6 "2017-01-12T18:30:15Z")

</div>

Tag Change scripts use newValue. So, you can test by using:

```auto
if newValue.value == 1:
```

Hope this helps!
