GAPTEQ provides two different types of session variables - client and server only - allowing you to work more efficiently with your application.
In this article you will read the following content:
When do session variables help you? A simple example:
Session variables can be used profitably if, for example, you need the VAT rate with 19% several times in your application. If the VAT rate changes, the new VAT rate only needs to be adjusted in one place and you save time!
1. Session variable: Client only
This variable type is suitable for saving states or values and can be used as a filter in data links.
Note! In the frontend, all components have access to this variable type and can also set new values. In the backend, at data layer level, it is not possible to work with this variable type.
- Click on “Session Variable” in the menu and define the name and data type.
- For Visibility, select “Client only”.
- You can set the value of the variable using any event. With “Add actions”, you can choose between the various client-only variables via “thisSession”.
Tip! If you want read-only access to the variable, you can also find it under thisSession.
2. Session variable: Server Only
Note! This variable type can only be set and queried in the backend.
In the data layer, this variable type can be used in the where condition and in the access rights (query restriction).
This variable type cannot be accessed in the frontend
- Values can only be set in the backend. This can be done, for example, via SQL statements or in the logon script, which is executed at every login.
3. Constant values
Note! A defined value is saved in Constant Values, which can be called up by all front-end components in the created application. The value of a constant cannot be changed during the session.
For this purpose, you can define the required constants and set values in the GAPTEQ Designer under Constant Values.
- Open the “Constant Values” tab in the main menu of the GAPTEQ Designer (directly next to “Session Variables - see screenshot above).
- Create a constant by clicking on the “Add” button below the constant values overview.
- Select a data type and assign a value to the constant.
Note! Constant values are provided together with the session variables under “thisSession”.
- When the button is clicked, the action “openUrlNewWindow(url)” is executed.
- In the custom expression, the previously created constant can be selected under “thisSession”.