GetAncestorAtFrequency

Returns the label of given Period dimension member’s ancestor at the specified frequency of the application’s frequency hierarchy.

Syntax

<HFMwPeriods>.GetAncestorAtFrequency (bstrPeriod, lFreq)

Argument

Description

bstrPeriod

The label of the Period dimension member. The specified period must be at a lower level in the frequency hierarchy than the frequency specified in the lFreq argument.

Input argument. String subtype.

lFreq

The internal ID of the frequency that contains the ancestor to be returned.

Tip:

You can get internal ID of a period’s frequency with GetFrequency, and the internal ID of a scenario’s default frequency with HFMwScenarios.defaultFrequency.

Input argument. Long subtype.

Return Value

Returns the label of the ancestor Period dimension member.

Example

The following function returns the label of a given period’s ancestor period at the default frequency of a given scenario. If the specified period is not at a lower level in the frequency hierarchy than the scenario’s default frequency, an empty string is returned.

Function getAncestorDefScenFreq(sPeriod, sScenario)
Dim cHFMMetadata, cHFMPeriods, cHFMScenarios
Dim lFrequency, sRet, lDefaultFreq
Set cHFMMetadata = cHFMSession.metadata
Set cHFMPeriods = cHFMMetadata.periods
Set cHFMScenarios = cHFMMetadata.scenarios
lDefaultFreq = cHFMScenarios.defaultFrequency(sScenario)
lFrequency = cHFMPeriods.GetFrequency(sPeriod)
If lDefaultFreq < lFrequency Then
   sRet = cHFMPeriods.GetAncestorAtFrequency(sPeriod, _
      lDefaultFreq)
Else
   sRet = ""
End If 
getAncestorDefScenFreq = sRet
End Function