Hey guys,
I have had a crack at trying to create run time displays to track how long machinery and devices such as pumps etc have been operating for to help the maintenance team. I am looking for some feedback to fix some issues I am having with the designer freezing when my template is on a screen. I am pretty new with ignition, so bear with me if my method for achieving this is sinful.
I will start with the issue, because maybe it is an easy fix but I have details of what I have done below
The Issue:
When the template I have created with a numeric display is on a screen with no tag bindings it is fine, once I link a tag to a template property the designer freezes (runs awfully slow) as noted in previous forum posts. I have checked for circular references and couldn’t find any so hoping some of you wizards could help me out.
This method was working for a few weeks then now it doesnt and I am unsure what I have changed to cause this. I know that it is this particular template because I deleted screen components in the XML one by one until I found this template to be the issue.
Background:
So I have turned on tag history on some Boolean tags that indicate when a device is on, example below.
I have then created a project script that given the inputs of the desired tag path, will return how many hours the tag has been active and outputs a float.
def getRuntimeHours(tagPath, startDate=None, endDate=None):
"""
Returns total runtime (hours) for a boolean historized tag.
"""
import system
from java.util import Date
try:
# ---- Sanitize tag path ----
if tagPath is None:
return 0.0
tagPath = str(tagPath).strip()
if tagPath == "":
return 0.0
# ---- Time defaults ----
if endDate is None:
endDate = system.date.now()
if startDate is None:
startDate = system.date.getDate(2026, 0, 1)
# ---- Query history ----
result = system.tag.queryTagHistory(
paths=[tagPath],
startDate=startDate,
endDate=endDate,
aggregationMode="DurationOn",
returnSize=1
)
if result is None or result.rowCount == 0:
return 0.0
# DurationOn returns SECONDS
secondsOn = result.getValueAt(0, 1)
if secondsOn is None:
return 0.0
return float(secondsOn) / 3600.0
except Exception as e:
# Throttled logging (won’t spam every second)
system.util.getLogger("RuntimeCalc").warn(
"Runtime calculation failed for tagPath=%r : %s" % (tagPath, e)
)
return 0.0
I have then made a template with a numeric display and a label with custom properties, show below.
Finally, I have the following expression script binded to the value of the numeric display
runScript(
"maintenance.getRuntimeHours",
1000,
toString({Run Time Display.tagPath})
)
I tried to give you guys as much detail so hopefully one of you wizards can point out what I am doing wrong.
Cheers

