Children Method

Returns the next child in the hierarchy for an object.

Syntax

object.Children

Applies To

Column Object

Dimension Object

Layer Object

Row Object

Discussion

Use this method to obtain the children for the Column, Dimension, Layer, and Row objects. The Children method accesses the different children for the current category. For example, the 1998 Q1 category has three children; 1998/January, 1998/February, and 1998/March.

For Dimensions, use the Change method to point to a specific category, the ChangeToTop method to point to the top level, and the ChangeToParent method to point one level higher in the hierarchy.

Return Type

Object

Example

This example gets the name of the children of the first category in the columns collection, then returns the number of items and names of the children in the collection.

Sub Main()
   Dim objPPRep As Object
   Dim objChildrenCols As Object
   Dim strColChild As String
   Dim strColChildren As String
   Dim intx As Integer
   Set objPPRep = GetObject(,"CognosPowerPlay.Report")
   Set objChildrenCols = objPPRep.Columns.Item(1).Children
   For intx = 1 to objChildrenCols.Count
      strColChild = objChildrenCols.Item(intx).Name
      strColChildren = strColChildren & chr$(10)
& _
         strColChild
   Next intx
   MsgBox "The " & objPPRep.Columns.Item(1).Name
& _
      " category has " & objChildrenCols.Count &
_
      " children." & chr$(10) & chr$(10) &
"They are: " & _
      chr$(10) & strColChildren, , "Column Children"
   Set objChildrenCols = Nothing
   Set objPPRep = Nothing
End Sub

Related Topics