Forum Discussion

tdugas's avatar
tdugas
New Contributor III
18 days ago

Pull Fx Rate based on scenario

I am trying to create a fx account that would dynamically pull based on scenario.  Below is the code I used for actuals and budget rate and it works great, however, for our forecast rates it does not pull any data.  The picture below shows the names of our fx rates, ie FCST_111 etc.  How do I create an account that would pull Fcst rate associated with the relevant scenario, ie S#fcst_1_11 = fX RATE = FcstAvgRate_1_11

 

Dim viewMember As ViewMember = ViewMember.GetItem(api.Pov.View.MemberPk.MemberId)
 
If viewMember.IsAnnotationType Then
 
    'Return an empty string if this is a text-based dataCell.
 
    Return ""
 
Else
 
    Dim destCurrId As Integer = api.Pov.Cons.MemberPk.MemberId
 
    If destCurrId = Currency.USD.Id Then
 
                    Return 1.0
 
    Else
 
        Dim rateType As FxRateType = api.FxRates.GetFxRateTypeForRevenueExp() 'AverageRate
 
        'Dim rateType As FxRateType = api.FxRates.GetFxRateTypeForAssetLiability() 'ClosingRate
 
        Dim cubeId As Integer = api.Pov.Cube.CubeId
 
        Dim timeId As Integer = api.Pov.Time.MemberPk.MemberId
 
        Dim sourceCurrId As Integer = Currency.USD.Id
 
        Dim rate As Decimal = api.FxRates.GetCalculatedFxRate(rateType, cubeId, timeId, destcurrid, sourceCurrId)
 
        Return rate

 

1 Reply

  • rhankey's avatar
    rhankey
    Contributor III

    It would appear you are not supplying any parameters to the api.FxRates.GetFxRateTypeForRevenueExp() function.  Without supplying options, GetFxRateTypeForRevenueExp() will return the FXRateType for the POV Cube/Scenario.