Levels Method
Syntax
Dimension.Levels([AlternateDrillDown])
Applies To
Discussion
Use this method to return a collection of Level objects for a dimension. To return the collection of Level objects in the primary drill-down path, call this method with no parameter. To return the collection of Level objects in the alternate drill-down path, call this method and specify the AlternateDrillDown parameter with the name of an alternate drill-down path. The objects this method returns represent all the levels available in that dimension, starting from the top-level category. For an alternate drill-down path, this method returns all levels starting at this path.
This method fails when
- the specified drill-down path is not in the dimension or is misspelled
- no levels are found for the dimension or specified drill-down path
- the drill-down path occurred more than once in the dimension
- the drill-down path specified was not an alternate drill-down path
Parameter |
Description |
---|---|
AlternateDrillDown |
Optional. Specifies the name of an alternate drill-down path. All levels starting at the alternate drill-down path are returned. This parameter is not case-sensitive. Type: String |
Return Type
Object
Example
This example returns a list of Level objects for the dimension. The category is being filtered for the dimension line index.
Sub Main()
Dim objPPRep As Object
Dim objDimension As Object
Dim objLevel As Object
Dim strLevelList As String
Dim intx As Integer
Set objPPRep = GetObject(,"CognosPowerPlay.Report")
Set objDimension = objPPRep.DimensionLine.Item(1)
For intx = 1 to objDimension.Levels.Count
Set objLevel = objDimension.Levels.Item(intx)
strLevelList = strLevelList & chr$(10) &
objLevel.Name
Set objLevel = Nothing
Next intx
MsgBox "The levels in the " & objDimension.Name
& _
" dimension are:" & chr$(10) & strLevelList
Set objDimension = Nothing
Set objPPRep = Nothing
End Sub