Now that you've created a page that displays folders in the left frame and a page that displays a list of reports in the right frame, you are ready to write a page called Menu.csp.
This page displays the full path to the current folder in the top frame and provides a link to the search page.
When querying for a Crystal Enterprise object, it is possible to retrieve property bags in addition to simple properties. A property bag is a collection of related properties. Although property bags are examined in much the same way as regular properties, there are some minor differences. Consider the following example, which uses the Folder property bag SI_PATH in order to examine the full path to a folder.
Select SI_PATH From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Folder'
Notice that you query for a property bag in the normal fashion. This query selects the SI_PATH Property from every folder on the APS.
To examine the properties in the SI_PATH collection, you have two options: you must either look up the property names using the Properties Property, or else know the names of the properties that the bag contains beforehand.
To examine the properties inside the property bag, use the following code.
For each prop in infoOb.Properties
if (prop.Container = False) then
Response.Write "Property Name: " & prop.name
Here, the Container Property is used to distinguish between simple properties and property bags. If the Container
property is not used in the enumeration, then the names of both simple properties and property bags will be printed. Note, however, that only the property bag names would be returned, and not the properties within them. Also be aware that property bags can contain other property bags.
Note: When iterating in VBScript, it is more efficient to use For...Each
than a regular For
loop. For more information, see Using For vs. For...Each.
In this tutorial, you will use the properties that are contained in the SI_PATH bag.They are listed below:
Property | Description |
---|---|
x represents the number of the folder you wish to access, and the larger the value of x, the higher up in the hierarchy the parent folder is.
If the number of parent folders in the bag is at least 1, you can access the parent of the selected folder in the following manner.
Result.Item(1).Properties("SI_PATH").Properties("SI_FOLDER_NAME1")
If the folder has no parent folders in its SI_PATH collection, then it is a top level folder. You can use this folder to retrieve the full path of a folder.
When there are a number of parent folders in the collection, you can retrieve them using one of the following expressions, all of which are equivalent:
Result.Item(1).Properties.Item("SI_PATH").Properties.Item("SI_NUM_FOLDERS")
Result.Item(1).Properties("SI_PATH").Properties("SI_NUM_FOLDERS")
Result("SI_PATH").Properties("SI_NUM_FOLDERS")
Note: For tips on how to reduce the amount of code you need to write, see Using default properties.
Try creating a complete path to the current folder for yourself. Recall that the page is divided into three frames. Write a page called Menu.csp
that will display a series of links to the current folder's parents. Place these links in the top frame of the page. This page should also include the name of the current folder and allow the user to click on any of its parent folders to navigate there. See Menu.csp for the solution.
Lesson 2e: Building a Home Page
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |