Time dependent popup

hello, i want to create a popup screen that apear when a tag value change for more than a defined time period ( lets say when a tag value change for more than 5 min a popup screen appears to the user ). any idea or suggestion could help a lot. thanks in advance

Are you using Vision or Perspective for this?


What type of tag do you want to trigger the popup?

I’m thinking you could have an a alarm on that tag, use that to trigger the popup.

it’s a boolen tag, i wrote this script when there is a value change :

if (previousValue.value == 0 and currentValue.value == 1) :
starttime= system.date.now()

while true :
tmp = system.date.now()

if datediff(starttime,tmp,"minute") >= 5 :
	system.nav.openWindow("SiteSpecific/fault description")
else : 
	"[.]Fault description tag .value"== "micro arrĂŞt"

i still doesn’t know if it works or not

Can you format the whole code ?

Also, I never used vision, but this seems weird to me:

first, you’re using ==, which is a comparison operator. Probably not what you want to do.
Also, both operands are strings.

1 Like

As @pascal.fragnoud has pointed out, your script has syntatical errors in it.


"[.]Fault description tag .value"== "micro arrĂŞt"

is not how you write a value to a tag.

To write a value to a tag you need something like:

system.tag.writeBlocking(['[.]Fault description tag'],['micro arrĂŞt'])

You have bigger problems with this script though, from what I can tell this is a Tag Value Change script, and doing this:

while true:

Is bad to say the least. Not only is it poor programming practice in general, but even without properly formatted code you have shown no way for the code to break out of the loop. You have created an infinite loop in a place where you want your scripts to execute as quickly as possible.

The dragons are circling.


Think of the Ignition Environment firing off the tag changes as the while True. Ignition will run the script when it is supposed to (assuming you have your tags set up correctly). But ultimately inside Ignition you never want a while True without some break condition.

Since this is just a boolean tag (and thus it staying True for 5 minutes is not going to trigger an additional tag event) you might want to consider a Gateway Timer Event that checks if the tag is True and then compares the timestamp of the tag ( which is when it last changed) to the current time - then you can see if it’s been more than 5 minutes, and if so, then you can have your gateway send a message to your client(s) to open up a popup window.

I think there may also be a way to do this via an alarm - have an alarm trigger if the value is True for more than 5 minutes and if so, run a script. But I am not as familiar with this perhaps someone else can speak on it.


In the Alarm Active event, you don’t have access to system.nav.* functions…
Like window = system.nav.openWindow('PopupWindow')

Gateway Timer Event is the best option… as @bkarabinchak.psi suggested…

Oh, I missed that!

An infinite loop on the UI thread is possibly even worse than one on a tag change script.

How about an expression memory tag with something like

&& minutesBetween({[.]boolean_tag.timestamp}, now()) > 5

then trigger the popup on tag change ?


Nah. Freezing the client kills just the one client. Bollixing up all of your tag event scripts will bring your entire system to a halt.


Just a tip, if your question involves code and you already have something written. You will get much better help/response time by posting relevant code right off the bat.