GetPeriodIndexFromPOVForDescriptions

Returns the index of a period within a subcube, given the subcube’s index and the period’s member ID. An index is returned only for periods with cells that contain descriptions.

Syntax

<HsvMDDataBufferLite>.GetPeriodIndexFromPOVForDescriptions lCubeIndex, lPeriod, plPeriodIndex

Argument

Description

lCubeIndex

Long (ByVal). The index of the subcube. Use BeginEnumeration or GetCubeIndexFromPOV to determine valid index values.

lPeriod

Long (ByVal). The member ID of the Period dimension member.

plPeriodIndex

Long. Returns the period’s index, or -1 if the period does not contain cells with descriptions.

Example

The following example gets a subcube’s index, the index of a period in the subcube, and the number of cells in the period that contain descriptions, then prints the cells’ descriptions to Visual Basic’s Immediate window. The example assumes that the member IDs of the subcube and period have been previously defined. GetCubeIndexFromPOV returns the index of the subcube. GetPeriodIndexFromPOVForDescriptions then gets the period’s index. GetNumCellsForDescriptions takes the subcube and period indexes and returns the number of cells that contain descriptions. For each cell, GetDescriptionAtIndex returns the cell’s description, which is then printed to the Immediate window.

Dim lCubeIx As Long, lPerIx As Long, lNumCells As Long
Dim lNumCubes As Long, sCellDesc As String
Dim lAcct As Long, lICP As Long, lCust1 As Long
Dim lCust2 As Long, lCust3 As Long, lCust4 As Long
m_cMDBufferLite.BeginEnumeration lNumCubes
m_cMDBufferLite.GetCubeIndexFromPOV m_lScen, m_lYear, m_lEnt, _ 
m_lPar, m_lVal, lCubeIx
' Exit if there are no subcubes
If lCubeIx = -1 Then
  m_cMDBufferLite.EndEnumeration
  Exit Sub
Else
  m_cMDBufferLite.GetPeriodIndexFromPOVForDescriptions _ 
  lCubeIx, m_lPer, lPerIx
  ' Exit if the period does not have cells with descriptions
  If lPerIx = -1 Then
    m_cMDBufferLite.EndEnumeration
    Exit Sub
  Else
    m_cMDBufferLite.GetNumCellsForDescriptions lCubeIx, _ 
    lPerIx, lNumCells
    For i = 0 To lNumCells - 1
      m_cMDBufferLite.GetDescriptionAtIndex lCubeIx, lPerIx, _ 
      i, lAcct, lICP, lCust1, lCust2, lCust3, _ 
      lCust4, sCellDesc
      Debug.Print sCellDesc
    Next i
  End If
End If
m_cMDBufferLite.EndEnumeration