The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
Marco
2 years agoContributor II
Currency Names
Hi Everyone.
I am performing a conversion in a SQL query using currencies; I relied on this other post for now.
Where is stored the Currency Name ?
The problem I have is that I have some SourceCurrencyId in the FXrates table that don't appear there, so I want to know if there's a way to get all possible currency names through a business rule.
To retrieve a Currency object from an ID:
Dim objCurrency As Currency = BRApi.Finance.Cons.GetCurrency(si, currencyId) BRApi.ErrorLog.LogMessage(si, $"Name: {objCurrency.Name}") BRApi.ErrorLog.LogMessage(si, $"Symbol: {objCurrency.Symbol}") BRApi.ErrorLog.LogMessage(si, $"Desc: {objCurrency.DefaultDescription}")To retrieve all Currency objects:
Dim allCurrencies as List(Of Currency) = Currency.GetItems()
4 Replies
- JackLacava
OneStream Employee
To retrieve a Currency object from an ID:
Dim objCurrency As Currency = BRApi.Finance.Cons.GetCurrency(si, currencyId) BRApi.ErrorLog.LogMessage(si, $"Name: {objCurrency.Name}") BRApi.ErrorLog.LogMessage(si, $"Symbol: {objCurrency.Symbol}") BRApi.ErrorLog.LogMessage(si, $"Desc: {objCurrency.DefaultDescription}")To retrieve all Currency objects:
Dim allCurrencies as List(Of Currency) = Currency.GetItems()- MarcoContributor II
Thanks
- MarcoContributor II
This gave me all the currency names, but is there a way to get them along with their IDs?
- JackLacava
OneStream Employee
Just loop on that allCurrencies, the objects have the Id property:
' in a custom calculate Dim allCurrencies As List(Of Currency) = Currency.GetItems() Dim sb As New System.Text.StringBuilder For Each cur As Currency In allCurrencies sb.AppendLine($"{cur.Name} - {cur.Id}") Next api.LogMessage("Currencies", sb.ToString)Btw, I would recommend to brush up on VB - trying to accomplish everything in OneStream with SQL increases complexity and sooner or later will hit a wall from a performance or maintenance perspective - or both.
Related Content
- 3 years ago
- 3 years ago