GetPeriodIndexFromPOVForLineItems

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 line items.

Syntax

<HsvMDDataBufferLite>.GetPeriodIndexFromPOVForLineItems 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 line items.

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 line items, then prints the line items’ 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. GetPeriodIndexFromPOVForLineItems then gets the period’s index. GetNumCellsForLineItems takes the subcube and period indexes and returns the number of cells that contain line items. For each cell, GetLineItemsAtIndex returns the line items’ data and descriptions, which are then printed to the Immediate window.

Dim lCubeIx As Long, lPerIx As Long, lNumCells As Long
Dim lNumCubes As Long, dCellData As Double, bYTD As Boolean
Dim vdCellData, vsDescs, lView As Long, lAcct As Long
Dim lICP As Long, lCust1 As Long, lCust2 As Long, lCust3 As Long
Dim 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.GetPeriodIndexFromPOVForLineItems lCubeIx, _ 
  m_lPer, lPerIx
  ' Exit if the period does not have cells with line items
  If lPerIx = -1 Then
    m_cMDBufferLite.EndEnumeration
    Exit Sub
  Else
    m_cMDBufferLite.GetNumCellsForLineItems lCubeIx, _ 
    lPerIx, lNumCells
    For i = 0 To lNumCells - 1
      m_cMDBufferLite.GetLineItemsAtIndex lCubeIx, lPerIx, i, _ 
      lAcct, lICP, lCust1, lCust2, lCust3, _ 
      lCust4, bYTD, vdCellData, vsDescs
      For j = LBound(vdCellData) To UBound(vdCellData)
        Debug.Print vdCellData(j) & " " & vsDescs(j)
      Next j
    Next i
  End If
End If
m_cMDBufferLite.EndEnumeration