Sessions and locale¶
Introduction
A session is a runtime context in which a user executes read and/or write operations based on their permissions. The session displays information, such as the groups to which the user belongs and their locale, which can be exploited to create dynamic interfaces according to the characteristics of the user.
Root session
When a Q Application is run on a target, it automatically generates a root session with a root user, necessary to start all the basic objects, such as communication drivers, alarms, dataloggers etc.
Note
the root user is a system user, not visible in the project nodes and cannot be modified, either at design time or at runtime.
The root session also creates the Presentation engine, if required in the project, that in turn generates one or more interactive sessions, depending on the Presentation engine type.
Interactive session and Presentation engine
If the user interface is set up in a project, a specific object called Presentation engine must be used, which generates an interactive session for the authenticated user at runtime. An interactive session is a session that displays an interactive user interface.
The user interface of an interactive session is always composed of instances of the **graphical objects set at design time, starting from the start window. In fact, the Presentation engine creates the start window in each interactive session, therefore all the objects displayed are instances.
The instances of graphical objects can be created/removed or displayed/hidden based on dynamic navigation logics, machine or project global status (for example based on the PLC status), or on session status (user permissions and session locale). These logics are created through navigation panels, NetLogic and display/non-display of objects.
In the following example, the start pages in the interactive sessions of the users User1, User2 and User3 are instances of the start page set in the Presentation engine. Each therefore contains several instances of the same A, B and C objects, displayed or hidden thanks to dynamic logics based on the user. In addition, the texts in the interface can be translated according to the user locale.
Possible scenarios depending on the Presentation engine
Below is a diagram that summarizes the possible runtime scenarios depending on the Presentation engines set in the project.
Native presentation engine
Web Presentation engine
If the project at runtime… |
Then… |
---|---|
only has a Native presentation engine object |
there is a root session and an interactive session in which the user can be changed. |
only has a web Presentation engine object |
there is a root session and there can be from zero to n interactive sessions. Each session is associated with a single user, and the same user can access multiple sessions simultaneously, for example from a PC and from a mobile device. |
has both Presentation engines |
the same user can access both the session generated by the Native presentation engine object on a device, and multiple sessions generated by the web Presentation engine object on other devices. |
Session nodes
To create application logics linked to the session user, Q Studio provides the session alias {Session}. This is a system alias pointing to the Session node, i.e. the node of the current session at runtime.
Therefore, dynamic links are created with the nodes inside the Session node, whose properties are assigned a value only at runtime based on the session user and session locale and/or user. In Q Studio, the session alias is available in the Dynamic Link Window when setting any graphical object properties.
The session nodes are described below:
Node |
Description |
---|---|
Groups |
Groups defined in the project. Each group displays one of the following values:
|
MeasurementUnits |
List of the available amounts. Every amount has the following properties available based on the locale:
|
LocaleIds |
Array of session locale IDs. Indicates all the locales supported by the user interface. |
User |
Session user. Contains the following properties:
|
See also
Related concepts
Related procedures
Related APIs