Forum Discussion
PB
2 years agoNew Contributor II
Use data buffer in dashboard data set
Can a databuffer be made available in a dashboard data set business rule? I'm trying to get a data buffer data into dashboard data set so that I can manipulate the output for reporting.
I tried p...
- 2 years ago
As RobbSalzmann said, you cannot use here any method that expects the api object, since that's available only in rules run by the Finance engine. This is why it doesn't show up in the helper tree, if you're writing a Dashboard DataSet:
You'll have to stick to BRApi functions instead. Example to do what you want there:
Dim mName as String = BRApi.Finance.Members.GetMemberName( _ si, _ dimTypeId.Account, _ cell.DataCellPk.AccountId) brapi.errorlog.logMessage(si, "My name is " & mName & " (Slim Shady)")Edit: for best performance, you probably want to cache the results of that GetMemberName in a dictionary, to avoid too many lookups that might end up hitting the database.
JackLacava
OneStream Employee
2 years agoIn the end, what you want is the actual data, isn't it? So you can use BRApi.Finance.Data.GetDataBufferDataCells instead:
You'll just need to create a DataUnitPK object, which represents the dataunit dimension members, and a DataBufferCellPK, which represents the common dimensions members.
Example:
' DataUnit coordinates: cubeId, entityId, parentId (use empty string if not needed), consId, scenarioId, timeId
Dim myDataUnitPk As New DataUnitPk( _
BRApi.Finance.Cubes.GetCubeInfo(si, "yourCubeName").Cube.CubeId, _
BRApi.Finance.Members.GetMemberId(si, dimTypeId.Entity, "YourEntity"), _
BRApi.Finance.Members.GetMemberId(si, dimTypeId.Entity, "YourParent"), _
DimConstants.Local, _
BRApi.Finance.Members.GetMemberId(si, dimTypeId.Scenario, "YourScenario"),
BRApi.Finance.Members.GetMemberId(si, dimTypeId.Time, "YourPeriod"))
' Buffer coordinates.
' Default to #All for everything, then set IDs where we need it.
' This example is equivalent to buffer "A#Sales:F#None"
Dim myDbCellPk As New DataBufferCellPk( DimConstants.All )
dbCellPk.AccountId = BRApi.Finance.Members.GetMemberId(si, dimTypeId.Account, "Sales")
dbCellPk.FlowId = DimConstants.None
' parameters: si, DataUnitPK, viewID, CommonMembersCellPk, includeUDAttributes, suppressNoData
Dim myCells As List(Of DataCell) = BRApi.Finance.Data.GetDataBufferDataCells(si, myDataUnitPk, dimConstants.YTD, myDbCellPk, False, True)
- PB2 years agoNew Contributor II
Thanks for the reply.
It seem like I'm not able to log the members themselves. I.e. I can output the values, but not the member names.
- JackLacava2 years ago
OneStream Employee
As RobbSalzmann said, you cannot use here any method that expects the api object, since that's available only in rules run by the Finance engine. This is why it doesn't show up in the helper tree, if you're writing a Dashboard DataSet:
You'll have to stick to BRApi functions instead. Example to do what you want there:
Dim mName as String = BRApi.Finance.Members.GetMemberName( _ si, _ dimTypeId.Account, _ cell.DataCellPk.AccountId) brapi.errorlog.logMessage(si, "My name is " & mName & " (Slim Shady)")Edit: for best performance, you probably want to cache the results of that GetMemberName in a dictionary, to avoid too many lookups that might end up hitting the database.
- PB2 years agoNew Contributor II
Excellent! Thanks - that works!
- RobbSalzmann2 years agoValued Contributor II
If this code is in a Dashboard Dataset rule, then api is null. This is why you're not getting a membername back using cell.GetAccountName(api). The GetAccountName method expects an instantiated FinanceRulesApi object to be passed in.
Related Content
- 3 years ago
- 2 years ago
- 2 years ago
- 5 months ago