Working with OScript Sessions

Many programming languages have the concept of a "Session", some such as Active Server Page (ASP) have their own Session Object, which can be used by developers to store information relevant for a single user's session, such as login name, permissions, pages visited etc. For more information on the concepts of Sessions see the W3Schools article on Sessions. Livelink has OScript Globals, being denoted by the $<variable name> format within OScript, but anything stored in these is available to all users and not just a single user's session.

If you do need to store data within OScript for a specific request or user session then you have a few options, including :

However, buried deep in the bowels of the LLIAPI module, is Livelink's Session Management components. These are implemented by only a handful of modules, including Records Management. The Session components are relatively simple to add into your own OScript modules using the following process :

To register your new Session component with Livelink you will need to add the following to <modulename>Root:Startup script :

// register our session object
$LLIAPI.SessionDataSubsystem.RegisterItem(<global name from Application Globals>, "<modulename>SessionData" )

When you want to populate the session with its data you can use the following code :

// Load the Session object into a variable
Dynamic sessionObj = $LLIAPI.SessionDataSubsystem.GetItem("<modulename>SessionData")
// Set the feature
sessionObj.<session feature name> = <session value you want to store>

Similarly, if you wish to use the values in the Seesion you can use the following code :

// Load the Session object into a variable
Dynamic sessionObj = $LLIAPI.SessionDataSubsystem.GetItem("<modulename>SessionData")
// Set the feature
<variable to populate from Session> = sessionObj.<session feature name>

This should get you started with using Session objects within your Livelink OScript modules when you need them.
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0