GetPeriodIndexFromPOVForData

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 data.

Syntax

<HsvMDDataBufferLite>.GetPeriodIndexFromPOVForData 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 data.

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 data, then prints the cells’ data 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. GetPeriodIndexFromPOVForData then gets the period’s index. GetNumCellsForData takes the subcube and period indexes and returns the number of cells that contain data. For each cell, GetDataAtIndex returns the cell’s data, which is then printed to the Immediate window.

Dim lCubeIx As Long, lPerIx As Long, lNumCells As Long
Dim lNumCubes As Long, dCellData As Double, bIsNoData As Boolean
Dim lView As Long, 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.GetPeriodIndexFromPOVForData lCubeIx, _ 
  m_lPer, lPerIx
  ' Exit if the period does not have cells with data
  If lPerIx = -1 Then
    m_cMDBufferLite.EndEnumeration
      Exit Sub
  Else
    m_cMDBufferLite.GetNumCellsForData lCubeIx, _ 
    lPerIx, lNumCells
    For i = 0 To lNumCells - 1
      m_cMDBufferLite.GetDataAtIndex lCubeIx, lPerIx, i, _ 
      lView, lAcct, lICP, lCust1, lCust2, lCust3, _ 
      lCust4, dCellData, bIsNoData
      Debug.Print dCellData
    Next i
  End If
End If
m_cMDBufferLite.EndEnumeration