Top N in Cubeview using BR
I am trying to get top N (top 10) customers by revenue account in my cubeview. For this i re-purposed the snippet finance code for List Ranked to this: Namespace OneStream.BusinessRule.Finance.Ranked_list Public Class MainClass Public Function Main( ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs ) As Object Try Select Case api.FunctionType Case FinanceFunctionType.MemberListHeaders Return New List(Of MemberListHeader) From { New MemberListHeader("Ranked") } Case FinanceFunctionType.MemberList If args.MemberListArgs.MemberListName.Equals("Ranked", StringComparison.InvariantCultureIgnoreCase) Then Dim header As New MemberListHeader("Ranked") Dim members As List(Of Member) = GetRankedMembers(si, api, args) Return New MemberList(header, members) End If End Select Return Nothing Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function #Region "Ranking Logic" Private Function GetRankedMembers( ByVal si As SessionInfo, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs ) As List(Of Member) Try '------------------------------- ' Required parameters '------------------------------- Dim rankType As String = args.MemberListArgs.NameValuePairs("RankType") Dim rankCount As Integer = Convert.ToInt32(args.MemberListArgs.NameValuePairs("RankCount")) Dim loopMemberFilter As String = args.MemberListArgs.NameValuePairs("LoopMemberFilter") If Not args.MemberListArgs.NameValuePairs.ContainsKey("DataCellToRankMemberFilter") Then Throw New Exception("Missing required parameter: DataCellToRankMemberFilter") End If Dim dataCellFilter As String = args.MemberListArgs.NameValuePairs("DataCellToRankMemberFilter") Dim cubeName As String = New MemberScriptBuilder(dataCellFilter).Cube '------------------------------- ' Determine looping dimension '------------------------------- Dim loopDimPk As DimPk = GetDimPkForLoopMemberFilter(si, api, cubeName, loopMemberFilter, dataCellFilter) Dim membersToLoop As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(loopDimPk, loopMemberFilter, Nothing) Dim rankedCells As New List(Of MemberAndCellValue) '------------------------------- ' Loop members and evaluate cell '------------------------------- For Each mi As MemberInfo In membersToLoop Dim mfb As MemberScriptBuilder = SubstituteLoopMember(loopMemberFilter, dataCellFilter, mi.Member.Name) Dim cell As DataCellInfoUsingMemberScript = BRApi.Finance.Data.GetDataCellUsingMemberScript( si, cubeName, mfb.GetMemberScript ) If cell IsNot Nothing AndAlso Not cell.DataCellEx.DataCell.CellStatus.Invalid AndAlso Not cell.DataCellEx.DataCell.CellStatus.IsNoData Then rankedCells.Add( New MemberAndCellValue( mi.Member, cell.DataCellEx.DataCell.CellAmount ) ) End If Next '------------------------------- ' Rank results '------------------------------- Dim result As New List(Of Member) Select Case rankType.ToUpperInvariant() Case "TOP" result = rankedCells. OrderByDescending(Function(x) x.CellValue). Take(rankCount). Select(Function(x) x.Member). ToList() Case "BOTTOM" result = rankedCells. OrderBy(Function(x) x.CellValue). Take(rankCount). Select(Function(x) x.Member). ToList() Case "MAX" Dim maxItem = rankedCells.OrderByDescending(Function(x) x.CellValue).FirstOrDefault() If maxItem IsNot Nothing Then result.Add(maxItem.Member) Case "MIN" Dim minItem = rankedCells.OrderBy(Function(x) x.CellValue).FirstOrDefault() If minItem IsNot Nothing Then result.Add(minItem.Member) End Select Return result Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function #End Region #Region "Helpers" Private Function GetDimPkForLoopMemberFilter( si As SessionInfo, api As FinanceRulesApi, cubeName As String, loopFilter As String, dataCellFilter As String ) As DimPk Dim cube As CubeInfo = api.Cubes.GetCubeInfo(cubeName) If cube Is Nothing Then Throw New Exception("Invalid cube: " & cubeName) Dim dimType As DimType = DimType.GetItem(loopFilter.Split("#"c)(0)) Dim mfb As New MemberScriptBuilder(dataCellFilter) Dim scenario As Member = api.Members.GetMember(DimTypeId.Scenario, mfb.Scenario) Dim scenarioType As ScenarioType = api.Scenario.GetScenarioType(scenario.MemberId) Dim dimId As Integer = cube.Cube.CubeDims.GetDimId(dimType.Id, scenarioType.Id) Return New DimPk(dimType.Id, dimId) End Function Private Function SubstituteLoopMember( loopFilter As String, dataCellFilter As String, memberName As String ) As MemberScriptBuilder Dim mfb As New MemberScriptBuilder(dataCellFilter) Dim dimType As DimType = DimType.GetItem(loopFilter.Split("#"c)(0)) Select Case dimType.Id Case DimType.Entity.Id : mfb.Entity = memberName Case DimType.Account.Id : mfb.Account = memberName Case DimType.UD1.Id : mfb.UD1 = memberName Case DimType.UD2.Id : mfb.UD2 = memberName Case DimType.UD3.Id : mfb.UD3 = memberName Case DimType.UD4.Id : mfb.UD4 = memberName Case DimType.UD5.Id : mfb.UD5 = memberName Case DimType.UD6.Id : mfb.UD6 = memberName Case DimType.UD7.Id : mfb.UD7 = memberName Case DimType.UD8.Id : mfb.UD8 = memberName End Select Return mfb End Function #End Region #Region "Helper Class" Private Class MemberAndCellValue Public Property Member As Member Public Property CellValue As Decimal Public Sub New(m As Member, v As Decimal) Member = m CellValue = v End Sub End Class #End Region End Class End Namespace After this changed My cubeview row member filter to this, however when cubeview runs , it runs for a bit and then page comes back completely blank : U5#Root.CustomMemberList( BRName = Ranked_list, MemberListName = Ranked, RankType = Top, RankCount = 10, LoopMemberFilter = U5#Total_Customer.Children, DataCellToRankMemberFilter = Cb#Financials :E#TotalEntity :C#USD :S#Actual :T#2026M1 :V#YTD :A#A5 :F#EndBal :O#Top :I#Top :U1#Organization :U2#Project :U3#None :U4#None :U6#None :U7#None :U8#None ) Does anyone know what i could be missing?12Views0likes0CommentsPass through external parameters into dynamic cube view services
Hello, Is there a way to pass a combo box paramater into a cube view service? I think would be through the Service Factory. Since the cube view service runs when the cube view is executed and there is no call as XFBRs or Dashboard extenders, Is there a way to pass parameter values into the cube view service business rule?32Views0likes1CommentCannot reference member expansion 1 from member expansion 2
Hi, I have a cube view with a straightforward requirement. Below is an example of my requirements using the Golfstream app. My rows are set as follows: Member filter 1: U2#Clubs.ChildrenInclusive:name(UD2: |MFUD2Desc|) Member filter 2: T#2011Q1.ChildrenInclusive:name(Time: |MFTime|, UD2: |MFUD2Desc| The below screenshot shows what this returns. The issue is that I need to reference the member filter 1 member from member filter 2. When I use |MFUD2| from member filter 2, it reverts to my top UD2 member rather than reading my UD2 member from member filter 1. I need this to do a more complicated loop through members, and that loop must take the row's UD2 member into account. Any advice or workarounds? User-created parameters and |CVUD2| do not return what I need.26Views0likes1CommentDrill-Down to Stage with Attribute Dimension
Hi everyone, I have two attribute dimensions in my model that I use to filter Cost Centers by Region and Line of Business. The issue is that when I try to drill down on those cells to reach the Stage data using “Load Results for Imported Cells”, I’m not able to get to the maximum level of detail. I assume this happens because the system is filtering by attribute members, which do not exist in the Stage tables. Has anyone experienced something similar or found a solution/workaround for this? Thanks in advance!26Views0likes0CommentsSecurity Report - Dashboard for Admin- Access
Good day to you. Currently, we are working on a Dashboard for User Access. We have successfully implemented the logic to retrieve Security Group Unique IDs along with their corresponding Security Group details. As part of this dashboard, we now need to retrieve Workflow Profile–level details, specifically: Entity assigned to the Workflow Profile Access Group Maintenance Group Workflow Execution Group Certification / Signoff Group So far, we have been able to retrieve details for points (1), (2), and (3). However, we are unable to fetch the Workflow Execution Group and Certification / Signoff Group details using either Business Rules or SQL queries. Could you please help us by suggesting: The appropriate Business Rule method/API, or A supported SQL approach, to retrieve these remaining Workflow Profile security details? Your guidance on the recommended approach would be greatly appreciated.Solved51Views0likes2CommentsEmbedded dynamic repeater
I have a cube view with a parameter on Entity |!Entity_select!| that I would like to put in a tabbed dashboard that has one tab for specific Entity member. I am using dashboard type "Embedded dynamic repeater" where the component is data explorer report. Data explorer report has data adapter component to the Cube View. I thought the way to do this would be to use the template parameter values in the collections. But it shows error as attached below. It seems that the template parameter value was not passed to Entity_select parameter. Is data explorer report component compatible for dashboard embedded dynamic repeater? Is there any sample of Embedded dynamic repeater dashboard using data explorer report component? TIA, Nuryana89Views0likes4CommentsHow to populate a Dashboard List Box referencing WFText4 but the UD dim may vary across Workflows?
As the title suggests, I am trying to populate a dashboard list box that references the Workflow text property regardless of the dimension being used. I'm able to populate the list box using a single dimension, meaning a UD3 member is populated on the workflow's WFText4 property and a member list parameter uses |WFText4| to pull it in. How would I get this to work if the Workflow text value is not always UD3? For Example (both workflows will be using WFText4): Canada Workflow A needs a UD3 Member.Base to populate in the list box when they run the dashboard in their workflow but Canada Workflow B needs a UD6 Member.Base to populate the list box when they run the dashboard in their workflow. Please let me know if I can provide more context.53Views0likes3CommentsNarrative Reporting Issue
Hello! Has someone tried Narrative reporting in 9.1 version? I am currently experiencing issues: 1.- Inserting charts/Advanced Charts / Reports if someone could insert an exaple on how they have done it. 2.- I cannot vie the artifacts and acces them, this message keeps popping up (and the names are fine) Thank you so much for the help!!181Views1like2Comments