Using the Crystal Enterprise query language

Now comes the task of querying the server. Crystal Enterprise uses an SQL-style language to query the server. Statements are generally written as SELECT <Properties> FROM CI_INFOOBJECTS WHERE <Conditions>. For a more detailed description of the query language used by Crystal Enterprise, see Syntax.

Your select statement will read:

Query = "Select SI_NAME, SI_ID from CI_INFOOBJECTS where " +

"SI_PROGID = 'CrystalEnterprise.Folder' AND SI_PARENTID=" + ParentID

Remarks

The properties that need to be retrieved are the name (SI_NAME) and the ID (SI_ID) of the folder.

Tip:    It is always preferable to list only the properties you need, rather than selecting all the properties using an asterisk (for example, Select * from CI_INFOOBJECTS). Listing the properties reduces the amount of information that needs to be sent across the network, and it lightens the workload on the server. For information on optimizing your queries, See Performance issues.

The FROM clause specifies that the data is being retrieved from CI_INFOOBJECTS. CI_INFOOBJECTS is a category in the APS InfoStore that contains a list of all existing objects (including folders, reports, and instances) in the Crystal Enterprise system.

The WHERE clause is the part of the statement that narrows the search. It is important to always include as much information as is possible in this clause as it greatly reduces the amount of time the APS will spend trying to retrieve data. In this case, only folders (SI_PROGID = 'CrystalEnterprise.Folder') should be returned, but only folders whose parent's ID matches the one supplied by the function parameters.

Note:    SI_PROGID is the definitive way of identifying an InfoObject. For further information on the ProgIDs that are available in Crystal Enterprise, see SI_PROGID Property.

Go to next step:

Adding a query function



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com