ChristianW
3 years agoValued Contributor
How do I get a dim name (dimpk) from a dim ID?
Hi all
Onestream stores a lot of information using an integer ID instead of a name. And most of the time we also deliver a simple way, to get objects (or names of objects) using an api or brapi cal...
- 3 years ago
I came up with some simple code to do so, do you know even simpler once?
BRAPI:
Dim aDimID As Integer = 0 Dim aDimName As String = BRApi.Finance.Dim.GetDim(si, New DimPk(dimtypeid.Scenario, aDimID)).Name brapi.ErrorLog.LogMessage(si, $"Name {aDimName}") aDimName = "" aDimName = brapi.Finance.Dim.GetDims(si, dimtypeid.Scenario).Find(Function(x) x.DimPk.DimId = aDimID).Name brapi.ErrorLog.LogMessage(si, $"Name {aDimName}")
and
Api:
Dim aDimID As Integer = 0 Dim aDimName As String = api.Dimensions.GetDim(New DimPk(dimtypeid.Scenario, aDimID)).Name brapi.ErrorLog.LogMessage(si, $"Name {aDimName}") aDimName = "" aDimName = api.Dimensions.GetDims(dimtypeid.Scenario).Find(Function(x) x.DimPk.DimId = aDimID).Name brapi.ErrorLog.LogMessage(si, $"Name {aDimName}")
Cheers