Please wait. Due to its content this page might take a while to load...
The Session mentioned in the chapters Project and Context Member as well as Group Values enables you to distinguish between different instances accessing your Widget Designer project. While it originally belongs to the section "Group Values", it is not only available in the Unlimited Webclients version, you can even use it in the Free Version.
The Session Value here is a valuable tool for generating Session- or user-based data sets.
A Session is generated every time a new browser connects to the Widget Designer project. As the main GUI is also displayed in an internal browser, this is always the first Session. The Free Version offers only one additional connection, the normal and Unlimited Version allow as many connected browsers as physically possible.
A new browser tab belongs to the same Session as the previous one, but if you open a second, different browser, like Chrome and Internet Explorer or Mozilla Firefox and Opera, a second Session is created. Each Session can be identified by its Key, a unique combination of letters and numbers. The Keys can be accessed from the Web Server menu, just go to Edit > Web Server Settings and open the tab "Sessions". There you will find a table containing all currently connected Sessions and the amount of Clients connected to this Session (note: two browser tabs of the same browser equal one Session and two Clients).
When a new Session is generated, a temporary cookie is stored with the browser and enables the Widget Designer to retrieve the stored information for several days, even if the browser was disconnected in between.
As a part of this conjunction between WD and specific clients, data can be saved corresponding to each Session: the Session Value.
A Session Value can be set with the Context object. It always consists of the specifier and a string value, other data formats are not allowed. Note that you can define an unlimited number of Session Values, you are not limited to only one data set per Session.
The value can be initialized, changed and retrieved with the expression: Context.Session.Value(specifier)
Imagine a user log in for every person accessing the WD interface via a remote browser.
The user, let us call him "Jonathan" can enter his name with an InputBox and submit this with a CustomScript button next to it:
Context.Session.Value("Username") = InputBox1.Text
A new Session Value called "Username" with the value "Jonathan" was generated and is accessible for this Session.
Now you want to use this information, e.g. log who accessed the interface and when. A ListView might be an option here:
Of course you can have more sophisticated logic behind this application and check if the respective cell is empty before writing something in it. If it is not, you would proceed to the next one or start from the beginning if the list is already full.
The true power of the Session Value comes into view when you combine this tool with JSON expressions. You can create entire large sets of data for each Session, store this with the Session Value and have complex, user input defined scripts and actions according to that.
Please bear in mind that a script containing the Context object, especially in combination with the Session Value, has to be executed from a real script, e.g. a CustomScript click. The "Test" function will not show the correct behavior!