GenoPro Home
GenoPro Home  |  SDK Home  |  Report Generator  |  Support  |  Search  |  Help  |  Site Map

Skip Navigation Links.

GenoObject.Session Property

Each object in the genealogy tree has its own Session for storage. The GenoObject.Session is different from the global Session object by offering finer storage granularity.

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.

oGenoObject.Session(strKey) = oGenericObject		' Store generic object to the Session
Set oGenericObject = oGenoObject.Session(strKey)	' Retrieve generic object from the session

Usage:
The use of GenoObject.Session is for experienced programmers. For instance, you may want to generate a repository of sources and citations. Instead of generating an HTML page for each source and citation, may want to write all of them to a single page. You can use the Session object to store the bookmark information for each citation, so you can later create hyperlinks to those citations. Similarly, you may want to format your citations to a special style (APA, LMA, AMA, CBE, Turabian, Chicago) and store the formatted text in the Session object. In this case, the strategy would be to format all your citations at the beginning of the report, store the formatted citation text to the Session object, and later retrieve the text from the Session object whenever needed.

Example:
To give a more down-to-earth scenario, let's use the Session object to store formatted text about the Place object. The following code stores the place name and city name in the Session object.


Dim strPlaceNameAndCity
For Each p in Places
    strPlaceNameAndCity = p.Name
    ' If the place name does not have a parenthesis, then
    ' add the city name, otherwise keep it as is.
    If (InStr(1, strPlaceNameAndCity, "(") <= 0) Then
        strCity = p.City
        If (strCity <> "") Then
            strPlaceNameAndCity = Util.FormatString("{} ({})", strPlaceNameAndCity, strCity)
        End If
    End If
    p.Session("strPlaceNameAndCity") = strPlaceNameAndCity
Next

Later in the report, you can use the following code to display a place such as the place of birth or place of death.

Report.WriteT3Br "Date of Birth: ", i.birth.date
Report.WriteT3Br "Place of Birth: ", i.birth.place.Session("strPlaceNameAndCity")
Report.WriteT3Br "Place of Death: ", i.death.place.Session("strPlaceNameAndCity")

Other Use of the Session Property:
There are many other use for the Session property. For instance, you may wish to generate a picture album and store thumbnail information about each picture, or assign the filenames associated to an event, individual or family.

A more complex case would be to attach a database ID or a recordset from an external database to a GenoObject . For instance, you may fetch additional contact information from a Microsoft Outlook file and bind them to the contact records in GenoPro. The strategy here would be to create a StringDictionary or an ObjectRepertory to store all unique contact information, then open the Outlook database and loop through each contact information. For each contact information in Outlook, add it to the StringDictionary or ObjectRepertory. Then, loop through each contact information in GenoPro. For each contact in GenoPro, perform a lookup if that contact information is in the StringDictionary or ObjectRepertory. If so, store the contact information from Outlook into the Session of GenoPro's contact object.

In summary, the GenoObject.Session is the cornerstone for generating sophisticated reports.

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 the Session, just set its value to Nothing.

p.Session("strPlaceNameAndCity") = Nothing

Citation Styles:
The following list is a summary of various styles for citing sources. The documentation of each citation style is beyond the scope of the Session property.

  • APA: psychology, education, and other social sciences.
  • MLA: literature, arts, and humanities.
  • AMA or CBE: medicine, health, and biological sciences.
  • Turabian: designed for college students to use with all subjects.
  • Chicago: used with all subjects in the "real world" by books, magazines, newspapers, and other non-scholarly publications.

 


See Also:
ObjectRepertory (class)

 

Copyright © 1998-2024. All rights reserved. GenoPro® and the GenoPro logo are registered trademarks.