ParentageQuery Object

Performs a query based on levels within a report.

Discussion

Use this object to query a report based on the level specified in the subset definition.

There are several variations of the ReportQuery object: AdvancedQuery, FindQuery, and ParentageQuery objects. A subset is the result of a query. It is a group of selected categories added to a Report object. For the ParentageQuery object, a subset is all the categories for a specified level.

The Item index for the ParentageQuery object starts at 1.

For a ParentageQuery, the order and structure of the subset definition (the components of the ParentageQuery object) are

Name

Category

LevelsDown

LowestLevel

Execute

AddToReport

Name

Description

AddToReport Method

Adds query results to a report.

Category Method

Sets the parent category or dimension for the ParentageQuery subset definition.

Execute Method

Runs a parentage query on a cube.

Item Method

Returns the ParentageQuery object from the ReportQueries collection.

Remove Method

Removes the ParentageQuery object from the ReportQueries collection.

Name

Description

Application Property

Returns the Application object.

Count Property

Returns a value giving the number of categories that satisfy the subset.

LevelsDown Property

Sets the number of levels down the hierarchy for specifying the next level Parentage subsets.

LowestLevel Property

Sets whether the query uses the next lower level or lowest level of the parent category.

Name Property

Sets or returns the name of the subset.

Type Property

Returns a query object type.

Example

This example creates a ParentageQuery (type 2) subset definition that returns all categories one level below Channels. Then the categories that are one level below Channels are added to the report as the first nesting level of rows.

Sub Main()
   Dim strCubePath As String
   Dim objPPRep As Object
   Dim objCategory As Object
   Dim objParent As Object   
   strCubePath = "C:\Cubes and Reports\Great Outdoors.mdc"
   Set objPPRep = CreateObject("CognosPowerPlay.Report")
   objPPRep.New strCubePath, 1
   objPPRep.ExplorerMode = False
   objPPRep.Visible = True
   Set objParent = objPPRep.ReportQueries.Add(2)
   With objParent
      .Name = "Sales Channels"
      .Category "Channels"
      .LowestLevel = False
      .LevelsDown = 1
      .Execute
      .AddToReport 0,1,6
   End With
   Msgbox "The first category added was " & _
      objParent.Item(1).Name & ".", ,"Subset"
   Set objParent = Nothing
   Set objPPRep = Nothing
End Sub

Related Topics