Hello everyone
I have a popup window, and I want it to appear when a tag changes from false to true.
I also require it to appear on a defined window, as I have 4 different windows, but I don’t want it to appear on all of them.
Hello everyone
I have a popup window, and I want it to appear when a tag changes from false to true.
I also require it to appear on a defined window, as I have 4 different windows, but I don’t want it to appear on all of them.
In the defined window, add a custom property to the root container and bind that tag to it. Define a propertyChange event on the root container that opens the popup when that property becomes true.
hello @pturmel
thank you very much.
I already added the ‘propertyChange’ event in the window where I want it to appear, but the popup window appears in other windows.
A propertyChange event must always have one or more checks for the correct event.propertyName
. I don’t see that in your screenshot.
Also, your if statement will never be true, since you are comparing a constant string against a constant integer. Bind the tag to a custom property. (A string containing a tag name doesn’t magically become the tag value.)
You code runs when any property of that component changes. That is certainly wrong. Use an if
statement to compare event.propertyName
against the property that should be triggering your code. Everything else (everything you have now) should be indented under that if
statement.
do you have an example?
Examples all over this forum:
https://forum.inductiveautomation.com/search?q=event.propertyName
Use the custom property name to which you bound your tag. No need to read the tag in your script since its value is in the custom property.
as a fun exercise, add this into your propertyChange event handler code:
print 'PropertyChange name: ', event.propertyName
Then save, close the resource, open your console in your designer or your client, and open the page again and see the number of propertyChange events you see. This will show you why you need to single-out the property name you’re looking for with:
if event.propertyName == 'property name':