SI_PARENTID Property

Applies To   See Also  

Identifies an object's parent. Indexed. Read/Write.

Type

Long

Syntax

SELECT

    SI_PARENTID

FROM

    [Categories]

WHERE

    SI_ID = ObjectID

The syntax has these parts:

Part Type Description

ObjectID

Long

A number that identifies the object you want to retrieve.

Used to access the property from a query result:

QueryResult.Item(Index).ParentID

Remarks

The SI_PARENTID property is a numeric Long value; it refers to the unique ID for a particular object's parent. It can be used to locate all the children for a particular object. This is mainly used to find the all the instances of a Report. In this case the parent object is the Report and its children are the various instances of the report that have been run or scheduled.

Do not confuse this property with the SI_PARENT_FOLDER property; the two are not equivalent. The following diagram illustrates the difference between them.

In this case, an instance is owned by a report, and the report is owned by a folder. That is, the SI_PARENT property for the Instance refers to the Report, and the SI_PARENT property for the report refers to the folder. The SI_PARENT_FOLDER property for both the instance, and the report, however, refer to the folder, and not the report.

This example selects all the reports for a particular folder whose ID is 275. The ID was chosen arbitrarily.

Select SI_NAME From CI_INFOOBJECTS Where SI_PARENTID=275 And SI_PROGID='CrystalEnterprise.Report'

In this case all the names of all reports contained within the folder were selected. Note that SI_PARENTID was used to specify the folder instead of SI_PARENT_FOLDER. If SI_PARENT_FOLDER were used instead, the select statement would have retrieved both reports, and their instances and we would have had to introduce a second 'And' clause. A statement equivalent to the one above would read:

Select SI_NAME From CI_INFOOBJECTS Where SI_PARENT_FOLDER=275 And SI_PROGID='CrystalEnterprise.Report' And SI_INSTANCE=0

Note that this property is read/write. If you change the Parent ID of an object, you can effectively move this object from parent to parent. For example, a report can be moved from folder to folder by changing its parent ID.

Example


Dim Parent

'The value below has been chosen arbitrarily.

Parent=123


'Create a query that selects all instances of a report

'object.

'SI_PARENTID is used to identify the parent report.

'SI_INSTANCE = 1 specifies that you only want report

'instances back.

query = "Select SI_NAME from CI_INFOOBJECTS where SI_PARENTID=" & cstr(parent) & " AND SI_INSTANCE = 1"


'Query the server.

Set result = iStore.query(query)



Or



'Query a particular object for its Parent's ID.

Query="Select SI_PARENTID From CI_INFOOBJECTS where SI_ID=123"

Set Result = iStore.Query(Query)

ID = Result.Item(1).ParentID




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