Skip to end of metadata
Go to start of metadata


Using the Tab Strip to navigate between windows is probably the most common way to navigate to different windows in a project. It can provide a set of tabs that can be clicked to navigate to the window that corresponds to that tab. The Tab Strip has a built in customizer, so it is easy to put together a tab strip that has a tab for every window of a project. It is best used on a docked window.


On this page ...


The Script Builder can be used to setup simple navigation options on buttons or other components. This allows you to better customize how your navigation works, instead of using a simple set of tabs. While the Navigation Script Builder is great for simple navigation, it can be limited in what it can do to navigate around your project. We can actually use the same navigation functions that drive the Script Builder to create a more complex approach to navigation, such as one button navigating to different places depending on what roles the user has.

Python - Opening Window based on User Role
# We first check if the user has the administrator role. That role determines which window will open.
if "administrator" in system.security.getRoles():
	system.nav.openWindowInstance("Popups/Administrator_Popup")
else:
	system.nav.openWindowInstance("Popups/Operator_Popup")



Navigation Functions


You can setup a special menu within the Menubar that allows you to navigate throughout the project using the scripting functions. They can be simple, like swapping to a window, or be more complex in how they navigate around the project. The benefit of using the Menubar for navigation is that it keeps navigation tucked away instead of using up valuable screen space. You can find the screen below in the Client Event Scripts space.


Each of the project templates that you can apply when creating a project uses a unique form of navigation. These are a great resource that can help give ideas on how to tackle navigation, or can be modified to work in your own project. These come in three types:

  • Single-tier navigation: There is a single level of buttons, each taking you to a different window
  • Double-tier navigation: There are two levels of buttons. The first set controls which set is displayed below, and the second set takes you directly to those windows.
  • Multi-tier navigation: There is a single tree-view style display that lists all available windows and can be grouped into folders. 

You can select one of the project templates when a new project is created. If you'd like to use them in an existing project, you could just create a new project with the template you want and copy the pages you need to your project.


Retargeting is a special form of navigation which involves navigating to an entirely different project. Retargeting is accomplished through scripting, usually as a response to a button press or other component event. The system.util.retarget() function allows you to 'retarget' the Client to a different project. You can have it switch to another project on the same Gateway, or another Gateway entirely, even across a WAN. This feature makes the vision of a seamless, enterprise-wide SCADA application a reality.

The retarget feature will attempt to transfer the current user credentials over to the new project / Gateway. If the credentials fail on that project, the user will be prompted for a valid username and password. Once valid authentication has been achieved, the currently running project is shut down, and the new project is loaded.

You can pass any information to the other project through the parameters dictionary. All entries in this dictionary will be set in the global scripting namespace in the other project. Even if you don't specify any parameters, the system will set the variable _RETARGET_FROM_PROJECT to the name of the current project and _RETARGET_FROM_Gateway to the address of the current Gateway.

Retargeting can be as simple as 1 line of code, just make sure you are using the project name (no spaces allowed), and not the title. See the retarget function in the appendix for more information.

Python - Retargeting to Another Project
# Retarget to another project on the same gateway.
# This script can be run from any button in a project.
system.util.retarget("My_Other_Project")



Retargeting



Local client fallback is not a navigation strategy in the normal sense (you cannot cause it to happen), but it is very useful when you want to ensure a user can continue work when the network goes out. Click the links to learn more about Local Client Fallback and about Ignition Edge.

Testing local fallback is highly recommended before you start to depend on it in a production setting. The easiest way to test fallback is to simply unplug the network cable to the Client machine, or disable the network card on the machine. If the Fallback Project button is not visible on the Gateway Connection Lost window, check your local Gateway console and verify that the message Started Fallback Socket on port 6501 is present in the console. Any other error message related to the Fallback Socket Controller indicates that some other problem has occurred (most likely the port cannot be reserved) and local fallback is not available to Clients.

In many circumstances, the communication loss to the central Gateway is only a temporary event. To minimize the amount of time that you need to run the local Client, you can add some functionality to the Client that allows you to check on the status of the central Gateway. One way to do this is to add a timer script to your local Client. The script calls the system.util.getGatewayStatus() function at regular intervals and updates an item such as a Client Tag with the Gateway status. Then, you can bind an indicator component to the Client Tag and get ongoing visual feedback on the central Gateway status. As soon as you can confirm that the central Gateway is running again, you can call the system.util.retarget() function in a button to seamlessly direct the Client back to the central Gateway.



Related Topics ...


  • No labels