Report Trigger every 30 min

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.

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

({[.]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.

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.

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

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.

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

if newValue.value == 1:

Hope this helps!