Forum Discussion

denisefockler's avatar
denisefockler
New Contributor III
6 hours ago

Public Overloads Function GetCalculatedFxRate... is obsolete

Is someone able to assist me with an alternative method for GetCalculatedFxRate on line 14 of the code below?  We just upgraded to 8.5.1 and this is no longer being supported.  In 8.2.3 it was still working.  This is a parser business rule that is being applied to a data source and calculation happening when data is being imported.

				'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
				'Purpose: Get Translation rate for To/From currencies on current record. 
				'		  Store translation rate in global variable to use with subsequent records for performance improvements.
				'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
								
				Dim time As String = api.CurrentDataClusterKey.TimeName 'Get current time.
				Dim currencyRate As Decimal = globals.GetDecimalValue(fromCurrency & "-" & toCurrency & "-" & time) 'Check Global variable for current translation rate.
				If Not currencyRate = Nothing Then 'If Globals is populated, return rate from global variable.
					Return currencyRate
				Else 'Else, get translation rate from Database and store in Global variable.
					Dim rateType As FxRateType = BRApi.Finance.Scenario.GetFxRateTypeForRevenueExpense(si, api.CurrentDataClusterKey.ScenarioID) 'Get Revenue rate type for current scenario
					Dim defaultCurrencyId As Integer = BRApi.Finance.Cubes.GetDefaultCurrencyId(si, 0) 'Get Cube's default currency ID
					Dim objActFxRate As New FxRatePkUsingNames(rateType.ToString, time, fromCurrency, toCurrency) 'Get rate information for current translation.
					Dim rate As Decimal = BRApi.Finance.Data.GetCalculatedFxRate(si, defaultCurrencyID, objActFxRate) 'Get translation Amount
					Globals.SetDecimalValue(fromCurrency & "-" & toCurrency & "-" & time, rate) 'Store current translation amount in global variable.
					Return rate 'Return Translation Rate.
				End If

Thank you, 

Denise

1 Reply

  • DanielWillis's avatar
    DanielWillis
    Valued Contributor

    Not just obsolete but also slightly changed; we observed different output in certain situations which is the issue mentioned below. GetFXRate is supposed to replace GetCalculatedFXRate and GetStoredFXRate.

    I would just forget the workaround mentioned and use GetFXRate since it seems to be the way forward.