GetDefaultExchangeRate

Returns the exchange rate between two currencies for the specified Point of View. You must specify a valid Point of View for entering currency rates; for information on entering currency rates, see the Oracle Hyperion Financial Management, Fusion Edition User's Guide.

Syntax

<HsvCalculate>.GetDefaultExchangeRate lScenario, lYear, lPeriod, lEntity, lAccount, lCustom1, lCustom2, lCustom3, lCustom4, lFromCurrencyId, lToCurrencyId, pdRate

Argument

Description

lScenario

Long (ByVal). The member ID of the Point of View’s Scenario dimension member.

lYear

Long (ByVal). The member ID of the Point of View’s Year dimension member.

lPeriod

Long (ByVal). The member ID of the Point of View’s Period dimension member.

lEntity

Long (ByVal). The member ID of the Point of View’s Entity dimension member.

lAccount

Long (ByVal). The member ID of the Point of View’s Account dimension member. This member must have an account type of Currencyrate.

lCustom1

Long (ByVal). The member ID of the source currency for which to obtain the exchange rate. This must be one of the currencies on the system-generated [Currencies] member list for the Custom 1 dimension.

lCustom2

Long (ByVal). The member ID of the destination currency for which to obtain the exchange rate. This must be one of the currencies on the system-generated [Currencies] member list for the Custom 2 dimension.

lCustom3

Long (ByVal). The member ID of the Custom 3 dimension member [None].

Tip:

The [None} member of a dimension can be represented by the HFMConstants type library constant MEMBERNONE.

lCustom4

Long (ByVal). The member ID of the Custom 4 dimension member [None].

lFromCurrencyId

Long (ByVal). The currency ID of the source currency.

Tip:

You can get a currency’s ID from the HsvCurrencies method GetCurrencyID.

lToCurrencyId

Long (ByVal). The currency ID of the destination currency.

pdRate

Double. Returns the exchange rate of the currencies.

Example

The following function returns the exchange rate of two currencies for the specified Point of View. The function take currency names as strings; the lCustom1 and lCustom2 arguments’ values are obtained by passing these names to IHsvTreeInfo.GetItemID, and the lFromCurrencyId and lFromCurrencyId arguments’ values are obtained by passing the names to HsvCurrencies.GetCurrencyID. The function takes the member IDs of the other dimension members.

Function getExchangeRate(lScen As Long, lYear As Long, lPer As Long, _
  lEnt As Long, sFromCurr As String, sToCurr As String, lAcct As Long) _
  As Double
Dim cCalculate As HsvCalculate, lFromCurr As Long, lToCurr As Long
Dim dRate As Double, cTreeInfo As IHsvTreeInfo
Dim cCurrencies As HsvCurrencies
Dim lCust1 As Long, lCust2 As Long, lCust3 As Long, lCust4 As Long
' g_cMetadata and g_cSession are previously set HsvMetadata and
' HsvSession instances
Set cCurrencies = g_cMetadata.Currencies
Set cCalculate = g_cSession.Calculate
Set cTreeInfo = g_cMetadata.Custom1
lCust1 = cTreeInfo.GetItemID(sFromCurr)
Set cTreeInfo = g_cMetadata.Custom2
lCust2 = cTreeInfo.GetItemID(sToCurr)
lFromCurr = cCurrencies.GetCurrencyID(sFromCurr)
lToCurr = cCurrencies.GetCurrencyID(sToCurr)
cCalculate.GetDefaultExchangeRate lScen, lYear, lPer, lEnt, lAcct, _
  lCust1, lCust2, MEMBERNONE, MEMBERNONE, lFromCurr, lToCurr, dRate
getExchangeRate = dRate
End Function