2 Tier Navigation with Client Event Script

I have a navigation window that I have created as shown below.

I am trying to use a Client Event Script to launch the appropriate window.
Shown below is the screenshots of the client event script.



The error stating “no viable alternative at input” appears?

I’m new to ignition and may not be understanding the syntax differences between the client event script and other areas.

Any help steering me in the right direction would be greatly appreciated.

Below is part of the script I am attempting to use.

if [default]NavSectionSelected.value = 'Section1':
    system.nav.openWindow('Section1')
    system.nav.centerWindow('Section1')

Try something like this:

if newValue.value == 'Section1':

or try:

if system.tag.read('[default]NavSectionSelected').value == 'Section1':

or if the tag will always have the window name in it you could save a lot conditions with something like this

windowName = system.tag.read('[default]NavSectionSelected').value
system.nav.openWindow(windowName)

I used your last option and it works perfect!

Just for my own learning, a tag cannot be pulled into a client event script without doing “system.tag.read”? Without this command the script doesn’t not have full definition of the tag path?

Thanks Nick!

Without reading the tag, you just have some sort of string tag path variable that python does not understand. ‘system.tag.read’ takes the string tag path, and reads and returns the qualified value. Without the ‘tag.read’, the python script doesn’t know how to interpret what you’ve typed in. In this case (client tag change script), it does know the tag value, but you would need to use the newValue.getValue() not the tag path. In other python scripts, you would need to use system.tag.read to get the tag value.

This is different from the expression language which would use something like this to get the tag value.

{[default]NavSectionSelected}
1 Like

Thank you. Your explanation is very helpful for understanding.