Session variables are important in a web application because they allow us to save some user data we can use later on. UD allows us to define a json structure in order to set or update a session variable.
A sessionupdates json structure is a json object having two fields:
- queryset: allows us to define one or more queries;
- sessionvars: allows us to define the session vars.
- label (optional if there is only one query): allows us to identify the query
- sql: sql statement
- parameters (optional): eventual sql parameter to pass to query
Each session variable we are going to define has a name. The varible can be set using information returned by a query, in this case we are going to spcify the querylabel and the sqlfield. The variable can be set using a getparameter, a postparameter (it defined if in a POST section), a constant or a composite field.
A filter can be applied when we define a session.
- name: the name of the session variable to update
- querylabel: refeerence to the label field defined in the query set
- sqlfield: used in case we need a value stored in a field that comes from a query
- getparameter: used in case we need a value stored in a getparameter parameter
- postparameter: used in case we need a value stored in a postparameter parameter
- constant: used in case we need define a costant
- composite: if we need to build a value as concatenation of different values
- filter: if we need to apply a filter of some sort to a value before to give it back
When user login to the system is automatically loaded and executed the file named session.json.
This file defines the session variables we need to set once the logni process has successfully ended. It contains basically a sessionupdates object in order to define the needed session variables.
A few session variable are defined by the system and are needed for UD to work. You shold not change those variables name, they are addressed as “system” variables.