Forum Discussion
Is your account dimension‘s name really „Account“ or do you use the Dimtype Name?
Try to replace „Account“ with the real dimension name like „CorpAccounts“, „ActAcc“, „BudAccnt“ or however the name of your account dimension is.
Then it should work.
- RobbSalzmann2 years agoValued Contributor II
Thank you for your thoughts. I tried this and got better results. However I can't use hard coded values at runtime.
Are you able to indicate which object can supply the dimension name, as I cannot know it prior to runtime. I'm probably missing something - I'm only able to see DimTypeName, that seems the closest I can get to looking up the dimname. Additionally, there are at least 2 dimensions on the rows.private List<string> GetFirstRowMembers(SessionInfo si, CVExtenderArgs args) { List<String> rowMembers = new List<string>(); CubeViewRow row = args.Report.CubeView.Rows.First(); List<CubeViewMemberExpansion> rowMemberExpansions = row.MemberExpansions; foreach(CubeViewMemberExpansion rowMemberExpansion in rowMemberExpansions) { string[] memberFilters = rowMemberExpansion.MemberFilter.Split(new char[]{',', ' '}); foreach(string memberFilter in memberFilters) { //This call returns null List<MemberInfo> members = BRApi.Finance.Metadata.GetMembersUsingFilter(si, rowMemberExpansion.PrimaryDimTypeName, memberFilter, false); //Returns null even with known, hard coded arguments //List<MemberInfo> members = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "Account", "a#16999.children", false); foreach(MemberInfo member in members) { string nameAdDesc = member.Member.NameAndDescription; rowMembers.Add(nameAdDesc); } } } return rowMembers; }
- JackLacava2 years agoHonored Contributor
Fun rabbit hole, I think I cracked it - just turn this VB in your fancy C#:
' first, figure out scenario type Dim scenarioName As String = args.CubeView.CubeViewPovMembers.Scenario.Name Dim scenarioId As String = BRApi.Finance.Members.GetMemberId(si, _ Dimtype.Scenario.Id, scenarioName) Dim scenarioTypeId As Integer = BRApi.Finance.Scenario.GetScenarioType(si, _ scenarioId).Id ' then get the cube Dim objCubeViewCube As CubeViewCube = args.CubeView.CubeViewCube Dim objCubeInfo As CubeInfo = BRApi.Finance.Cubes.GetCubeInfo(si, _ objCubeViewCube.Name) ' now we can look up any dimension Dim accountDimId As Integer = objCubeInfo.Cube.CubeDims.GetDimId( _ dimtype.Account.Id, scenarioTypeId) Dim accountDim As OneStream.Shared.Wcf.Dim = BRApi.Finance.Dim.GetDim(si, _ New DimPk(dimType.Account.Id, accountDimId)) brapi.ErrorLog.LogMessage(si, $" {accountDim.Name}")
Note: this relies on the Scenario being fixed in the CV Pov. If you have multiple ones, you'll have to get them first (from either cv, rows, columns, etc) and retrieve their scenario types so you can do the lookup. That's because our beloved Extensible Dimensionality ™ allows for dimensions to change not just by Cube but also by Scenario Type.
Related Content
- 3 years ago
- 3 years ago
- 3 years ago