GetPeriodFromFrequency

Returns the member ID of the period that is at a given ordinal position within a frequency.

Syntax

<HsvPeriods>.GetPeriodFromFrequency lFreq, lPeriodNumInFreq, plPeriod

Argument

Description

lFreq

Long (ByVal). The ID of the frequency. To use the application’s base frequency, pass the ID returned by GetBaseFrequency.

lPeriodNumInFreq

Long (ByVal). The period’s ordinal position within the frequency. This is zero-based, so pass 0 to get the member ID of the first period, 1 to get the member ID of the second period, and so on.

plPeriod

Long. The member ID of the period.

Example

The following example creates a function named GetOrdinalPerName that takes the ordinal position of a period and returns the period’s label. In this function, GetBaseFrequency returns the ID of the application’s default frequency. This ID is passed to GetPeriodFromFrequency along with the ordinal position. The member ID returned by GetPeriodFromFrequency is passed to IHsvTreeInfo.GetLabel, and the returned period label is set as GetOrdinalPerName’s return value.

Function GetOrdinalPerName(lPerPos As Long) As String
Dim cTreeInfo As IHsvTreeInfo, cPeriods As HsvPeriods
Dim lFreqID As Long, lPerID As Long, sPerName As String
Set cTreeInfo = m_cMetadata.Periods
Set cPeriods = m_cMetadata.Periods
cPeriods.GetBaseFrequency lFreqID
cPeriods.GetPeriodFromFrequency lFreqID, lPerPos, lPerID
cTreeInfo.GetLabel lPerID, sPerName
GetOrdinalPerName = sPerName
End Function