GetPeriodsInFrequency

Returns an array containing the member IDs of a frequency’s Period dimension members.

Syntax

<HsvPeriods>.GetPeriodsInFrequency lFrequency, pvaralPeriodIDs

Argument

Description

lFrequency

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

pvaralPeriodIDs

Variant array. Returns the member IDs of the periods in the frequency. The array is returned as a Long subtype.

Example

The following example creates a function named CheckPeriodsInYear that returns a count of the periods in an application’s base frequency. GetBaseFrequency gets the ID of the base frequency; this ID is then passed to GetPeriodsInFrequency. The returned array of period IDs is passed to UBound; since this is a zero-based array, 1 is added to the number returned by UBound to calculate the count of periods, and the sum is set as CheckPeriodsInYear’s return value.

Function CheckPeriodsInYear() As Long
Dim cTreeInfo As IHsvTreeInfo, cPeriods As HsvPeriods
Dim lFreqID As Long, vaPeriods
Set cTreeInfo = m_cMetadata.Periods
Set cPeriods = m_cMetadata.Periods
cPeriods.GetBaseFrequency lFreqID
cPeriods.GetPeriodsInFrequency lFreqID, vaPeriods
CheckPeriodsInYear = UBound(vaPeriods) + 1
End Function