Forum Discussion
So, in my example in Golfstream I use the Custom Member list XFR_MemberListRanked, based on the entity dim. In your case you are ranking on the UD1 dim. So bear this in mind.
What you need to do, is share the ranked list generated by XFR_MemberListRanked, so it can be re-used by a DynamicCalc UD8 member in the CubeView cells.
To do this, once you have generated your list of ranked members (in the XFR_MemberListRanked BR), you can store it in the SessionState, like this:
Dim memListHeader As New MemberListHeader(args.MemberListArgs.MemberListName)
Dim topNMems As List(Of Member) = Me.GetRankedMembers(si, api, args)
Dim topNMemList As New MemberList(memListHeader, topNMems)
'---- Now remember the topN Members in a Session State, as a comma separated list of names ---
Dim lstMemberNames As New List(Of String)
For Each mbr As Member In topNMems
lstMemberNames.Add(mbr.Name)
Next
Dim strMemberNames As String = String.Join(",", lstMemberNames)
brapi.State.SetSessionState(si, False, ClientModuleType.Unknown, "String", "Rank", "Rank", si.UserName, strMemberNames, Nothing )
Return topNMemList
Again this is based on the Golfstream XFR_MemberListRanked. If you have adapted this to work as an XFBR rule (instead of a Custom Member List rule) then you will need to adapt this accordingly.
Then create a UD8 dynamic calc member, and refer to it in a column in your cubeView , like this:
U8#GetCumulativeRanked:Name("Ranking Cumulative")
The DynamicCalc formula looks like this (REMEMBER change Entity to UD1 in your case)
If lstRankedNames Is Nothing Then
Dim strRankedMemberNames As String = brapi.State.GetSessionState(si, False, ClientModuleType.Unknown, "String", "Rank","Rank", si.UserName).TextValue
lstRankedNames = strRankedMemberNames.Split(","c).ToList()
End If
Dim sbAccumExpression As New Text.StringBuilder
For Each strMbrName As String In lstRankedNames
If sbAccumExpression.Length = 0 Then
sbAccumExpression.Append( String.Format("U8#None:E#[{0}]", strMbrName) )
Else
sbAccumExpression.Append( String.Format("+ U8#None:E#[{0}]", strMbrName) )
End If
If strMbrName.XFEqualsIgnoreCase(api.Pov.Entity.Name) Then Exit For
Next
Return api.Data.GetDataCell( sbAccumExpression.ToString() )
'---- Now put in the section "Helper Functions Header..."
Private Shared lstRankedNames As List(Of String) = Nothing
Hi Chris - Do you happen to have the XML for this updated BR showing exactly where to add the SessionState member list code into the existing BR?
Regardless, this post is very helpful. Thank you!
- ChrisLoran4 years agoValued Contributor
No I could only put in text , it won't let me upload XLM files as attachments.
The code text should already be in the previous response, suggest copy/paste from there.
Related Content
- 2 years ago
- 2 years ago
- 2 years ago
- 3 years ago
- 11 months ago