How to bring up another screen using value change in tag script

I want to use a tag event to display another screen when the value exceeds that value, but it doesn't work.


The error is pretty clear: You forgot the colon after your if condition.
The two dots at the end of the line.
if currentValue.value > 10:

I fixed it as you said and tried again, but I got the following error.

  • Error executing script.
    Traceback (most recent call last):
    File "tagevent:valueChanged", line 3, in valueChanged
    at com.inductiveautomation.perspective.gateway.script.AbstractScriptingFunctions.getSession(
    at com.inductiveautomation.perspective.gateway.script.AbstractScriptingFunctions.operateOnSession(
    at com.inductiveautomation.perspective.gateway.script.AbstractScriptingFunctions.operateOnPage(
    at com.inductiveautomation.perspective.gateway.script.PerspectiveScriptingFunctions.popupAction(
    at com.inductiveautomation.perspective.gateway.script.PerspectiveScriptingFunctions.openPopup(
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: No perspective session attached to this thread.

You're trying to do a perspective thing outside of the perspective's scope.

You can't open a popup directly from a gateway event.
What you can do is send a message from that event, and catch it with something that's on all your perspective screens. In that handler, you'll be able to open a popup.

There may be better solutions to this.
Maybe bind the tag to a session custom prop, and use that property to do things.

Uploading: TAG4.GIF...

Does the session customization you're referring to refer to the attachments?

It's my first time using ignition, so can you give me a simple example of how you said?


Unlike a stand-alone HMI, there is separation in Ignition between gateway activities that are global and activities that are related to client user interfaces. Tags are global, and their scripts are isolated from User interfaces, and cannot directly affect them.

Instead, "pull" the tag into your user interface by binding it to a custom session, page, view, or component property (depending on the specificity you need for any resulting actions), then use an onChange action to run the script in the UI.

You mean use "Session Events" for "Perspective"?

No, session custom properties. Create one. Bind the tag of interest to it. On the property, define an valueChange event.

Or, perhaps, use a custom property in a narrower scope.