ItemAtLevel Method
Syntax
collection.ItemAtLevel(Label or Index, Level)
Applies To
Discussion
Use this method to retrieve a row or column from a Rows or Columns collection in a nested crosstab report. The Item method can be used for non-nested reports.
The item to search for is set using the Label parameter. The level where the item resides is set using the Level parameter, where 0 indicates the level closest to the actual data --that is, the lowest level row or column--and 1, means the next level up, and so on. For example, where a crosstab has levels for Years and Months and then data, level 0 is Months and level 1 is Years.
The row or column object returned could span multiple indexes when the level is > 0.
ItemAtLevel is equivalent to Item when level = 0.
| Parameters |
Description |
|---|---|
| Label |
Required. Specifies the category label or index of the object to return. Type: Variant |
| Level |
Required. Specifies the value indicating the nesting level in which to add the categories. Type: Long |
Return Type
Object
Example
This example selects the last column in the report, applies a style to it and changes the cell size.
Sub Main() Dim objPPRep As Object Dim intCount As Integer Set objPPRep = GetObject(,"CognosPowerPlay.Report") intCount = objPPRep.Columns.Count objPPRep.Columns.ItemAtLevel(intCount,0).Select objPPRep.StyleSelected "Good News" objPPRep.SizeSelected 100 Set objPPRep = Nothing End Sub