Subset Method

Returns a subset of objects from the current collection.

Syntax

collection.Subset(IndexOfFirstCategory, IndexOfLastCategory)

Applies To

Columns

Layers

Rows

Discussion

A subset is a group of categories used to isolate information that shares some common criteria. The subset can include all the objects in the collection.

Parameters

Description

IndexOfFirstCategory

Required. Specifies the index or category name of the first category of the range.

Type: Integer

IndexOfLastCategory

Required. Specifies the index or category name of the last category of the range.

Type: Integer

Return Type

Object

Example

This example uses the Subset method to add the first three rows in the open report.

Sub Main()
   Dim objPPRep As Object
   Dim objNewCol As Object
   Dim objNewRow As Object
   Set objPPRep = GetObject( , "CognosPowerPlay.Report")
   Set objNewRow = objPPRep.Rows.Subset(1, 3).Addition
   MsgBox "The sum of the first three rows is " _
      &objPPRep.CellValue(objNewRow(1).Index,1)
   Set objNewCol = objPPRep.Columns.Item(4).Addition
_
      (objPPRep.Columns.Item(1))
   MsgBox " The sum of column one and column four is
" _
      &objPPRep.CellValue(1,objNewCol.Index)
   objPPRep.Save
   Set objNewRow = Nothing
   Set objNewCol = Nothing
   Set objPPRep = Nothing
End Sub

Related Topics