ParentageQuery Object
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 |
---|---|
Adds query results to a report. |
|
Sets the parent category or dimension for the ParentageQuery subset definition. |
|
Runs a parentage query on a cube. |
|
Returns the ParentageQuery object from the ReportQueries collection. |
|
Removes the ParentageQuery object from the ReportQueries collection. |
Name |
Description |
---|---|
Returns the Application object. |
|
Returns a value giving the number of categories that satisfy the subset. |
|
Sets the number of levels down the hierarchy for specifying the next level Parentage subsets. |
|
Sets whether the query uses the next lower level or lowest level of the parent category. |
|
Sets or returns the name of the subset. |
|
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