Session Class
The Session is a repertory to share data between pages. The
report generator resets the script at the beginning of each page and the
Session object is the only mechanism to preserve data when the
script terminates. Please notice the Session is for sharing data
between pages, not between reports. You get a new Session object
each time you generate a report.
Syntax:
The Session object is an instance of the
ObjectRepertory
class. Whatever you can do with an ObjectRepertory , you can do it
with the Session object.
Session(strKey) = oGenericObject ' Store generic object to the Session
Set oGenericObject = Session(strKey) ' Retrieve generic object from the session
Usage:
There are many uses for the Session object. For instance, you may
have one page displaying all the names sorted alphabetically and want to have
another page displaying an index of those names. Instead of repeating the code
to generate a full list of names and to generate the index, you can use the
Session to store the unique names. Later, you can retrieve the unique
names from the session and generate the index of names. Similarly, you may have
one page generating a picture album and another page creating a summary of the
picture album. Instead of repeating the code on two pages, you can use the
Session object to store picture summary details.
Syntax:
The Session object is an instance of the
ObjectRepertory
class. Whatever you can do with with an ObjectRepertory , you can do
it with the Session object.
Set oDictionary = Util.NewStringDictionary()
Session("oDictionary") = oDictionary
Session("strTitleReport") = "My Report"
Session("cMaximumPicturesPerPage") = 20 To access an object from the
Session, use the following syntax:Set oDictionary = Session("oDictionary")
Report.WriteText Session("strTitleReport")
cPicturesMax = Session("cMaximumPicturesPerPage")
Tip:
You will find sample code using the Session object in the file
Init.htm. The code is well documented and you can modify it to tweak the report
to your needs.
Memory Life Cycle:
Any object or value stored in the Session object will be
automatically freed when the report engine shuts down. You don't have to any
special processing to unload the objects from memory - GenoPro does it
automatically for you. To explicitly unload an object from memory, just set its
value to Nothing .
Session("oDictionary") = Nothing
See Also:
GenoObject.Session
ObjectRepertory
|