Forum Discussion

Johnny's avatar
Johnny
New Contributor II
2 years ago

Custom Member List Sort with POV Input

Hihi, I am using a variant of the GolfStream finance business rule "XFR_MemberListAlphabetical" and need to pass an additional variable into the rule. For a Finance rule, is it possible for a CV or QV to pass the MF variable to the rule? Currently, the rule is setup statically on a starting entity:

 

Dim MemberListstart As String = "E#[Total GolfStream].base""

 

However, because our organization has thousands of entity, the finance rule passes all base entity into the QV. With suppression, I can arrive at the relevant members, however, it significantly slows down the rendering of the report. I've tried using the api.POV command, but it passes the user CV pov, which is not always relevant to the CV. Is there a way to pass a variable using something like an args.NameValuePairs()? I am having difficulty with the limitations of the finance rule VBA set.

Essentially, I need the memberfilter builder of "E#[MyEntity].XFR_MemberListAlphabetical,Ent_Sort]" to use "E#[MyEntity] as the MemberListstart string.

Here is the GolfStream rule for reference:

 

Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, _
    ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As Object
Try

	'This will put a member list of a dimension in Alphabetical order.
	'Use the following on the cube view E#Member.[Name of Business Rule, Name of List in Business Rule]
	'E#Root.[XFR_MemberListAlphabetical, EntityAlphabetical]
	Dim Memberlistname As String = "Ent_Sort"
	Dim MemberListstart As String = "E#[Total GolfStream].base"

	Select Case api.FunctionType
		Case Is = FinanceFunctionType.MemberList
			If args.MemberListArgs.MemberListName = Memberlistname Then
				Dim objMemberListHeader = New MemberListHeader(args.MemberListArgs.MemberListName)

				'Read the members
				Dim objMemberInfos As List(Of MemberInfo) = api.Members.GetMembersUsingFilter( _
							args.MemberListArgs.DimPk, MemberListstart, Nothing)

				'Sort the members
				Dim objMembers As List(Of Member) = Nothing
				If Not objMemberInfos Is Nothing Then
				objMembers = (From memberInfo In objMemberInfos _
							Order By memberInfo.Member.Name Ascending _
							Select memberInfo.Member).ToList()
				End If

				'Return
				Return New MemberList(objMemberListHeader, objMembers)
			End If
	End Select
	Return Nothing
...

 

  • Dim MemberListstart As String = $"E#[{args.MemberListArgs.TopMember.Name}].base"

    Generally speaking, when manipulating rules, always have a look in the helper tree for what the args object will provide. In this case, it has a TopMember property that points to the member passed when calling the list.

  • JackLacava's avatar
    JackLacava
    Honored Contributor
    Dim MemberListstart As String = $"E#[{args.MemberListArgs.TopMember.Name}].base"

    Generally speaking, when manipulating rules, always have a look in the helper tree for what the args object will provide. In this case, it has a TopMember property that points to the member passed when calling the list.