Copy FXRates

OSAdmin
Valued Contributor
Originally posted by Diane Rochford

Has anyone copied FXRates from prior month Closing FXRate to current month Average FXRate?  In HFM, I can copy last period in year closing FXRates, Actual scenario, to both current closing and current average rate, constant $ scenario. I was also able to copy the prior month closing rate to all future period closing rate and average rate within the Forecast scenario.

I would expect I can do these copied within OneStream, I just cannot find where, or how, I can accomplish this task.

 

Help is greatly appreciated.

 

Thanks

Diane

 

 

1 REPLY 1

ChristianW
Valued Contributor

Hi Diane

Yes, it is possible, this sample will do what you described.

You can run it in any business rule type. I tested it in an Extender business rule, you can call it using a Data Management Job and/or schedule it to run every month using Task Scheduler. In these cases, you should not pick the actual period from the user interface, but pass a parameter.

In the sample, I didn't test if I might override an existing exchange rate, please be careful to avoid unexpected results.

Dim actualPeriod As String = TimeDimHelper.GetNameFromId(si.WorkflowClusterPk.TimeKey)
Dim previousPeriod As String = TimeDimHelper.GetNameFromId(TimeDimHelper.GetPriorPeriod(si.WorkflowClusterPk.TimeKey, True))

For Each sourceCurrency As Currency In Currency.GetItems
	For Each targetCurrency As Currency In Currency.GetItems
		Dim fxRatePkUsingNames As New FxRatePkUsingNames("ClosingRate", previousPeriod, sourceCurrency.Name, targetCurrency.Name)
		Dim objFxRateUsingNames As FxRateUsingNames = BRApi.Finance.Data.GetStoredFxRate(si, fxRatePkUsingNames)	
		
		If objFxRateUsingNames.Amount > 0 Then
			Dim fxTargetRatePkUsingNames As New FxRatePkUsingNames("AverageRate", actualPeriod, sourceCurrency.Name, targetCurrency.Name)
			Dim objFxTargetRateUsingNames As New FxRateUsingNames(fxTargetRatePkUsingNames, objFxRateUsingNames.Amount)
			Dim objXFResult As XFResult = BRApi.Finance.Data.SetFxRate(si, objFxTargetRateUsingNames)
		End If
	Next
Next	

 I hope this helps and kind regards

Christian