Add Method (ReportQueries)
Syntax
ReportQueries.Add Type
Applies To
Discussion
Use this method to create and add a new query, and return the new query object. You can group query objects from a Report object into a ReportQueries collection. You can use this method to add categories to the report from the CategoryList object, and then create query objects.
The ReportQueries collection is a special object that belongs to the Report object. There are several variations of the query objects that belong to the ReportQueries collection; the FindQuery, ParentageQuery, and AdvancedQuery.
Parameter |
Description |
---|---|
Type |
Required. Specifies a numerical value that identifies the type of query to add to the query object. 1 = Find Query 2 = Parentage Query 3 = Advanced Query 4 = ValueRestriction Query Type: Integer |
Return Type
Object
Example
This example creates an AdvancedQuery (type 3) subset definition that retrieves all categories belonging to Europe. This subset is then added to the report as rows.
Sub Main()
Dim strCubePath As String
Dim objPPRep As Object
Dim objAdvanced 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 objAdvanced = objPPRep.ReportQueries.Add(3)
With objAdvanced
.Name "European Countries"
.Dimension "Locations"
.Level "Country"
.Include "Europe"
.Execute
.AddToReport 1,1,3
End With
Msgbox "Name: " & objAdvanced.Name & chr$(10)
& _
"Dimension: " & objAdvanced.Dimension &
chr$(10) & _
"Level List: " & objAdvanced.LevelList &
chr$(10) & _
"Query Type Code: " & objAdvanced.Type &
chr$(10) & _
"Number of Categories: " & objAdvanced.Count
& _
chr$(10) & _
"First Category: " & objAdvanced.Item(1).Name,
_
,"Subset"
Set objAdvanced = Nothing
Set objPPRep = Nothing
End Sub