01-23-2024 08:53 AM - last edited on 01-23-2024 10:43 AM by JackLacava
Hi everyone,
I have the current Entity hierarchy:
I created a cubeview that allows the user to initially select a base entity from a dropdown list to be used as Entity member within the cubeview.
In some of the rows, though, I'd like to consider the Legal Entity code rather than the base member code (for example, assuming the user initially selects 1010TRW, I want two rows to use 1010 as Entity member whereas the rest of the rows will use 1010TRW).
Is there a straightforward way to consider the first 4 characters of the parameter in one of the rows of the CV?
I tried to search for functions to be used in the Member filter builder window
but I did not find any.
Thanks in advance for any help!
Solved! Go to Solution.
01-23-2024 09:18 AM
Hi @fc ,
Not sure what your condition is on when you want to use the Left string truncation logic, or return the entire Entity name. But you would do it with an XFBR String rule. The code to call it is here that would go in your Cube View row, and an example function that will return the first 4 characters of the Entity parameter selected:
Hope this helps,
01-23-2024 09:18 AM
Hi @fc ,
Not sure what your condition is on when you want to use the Left string truncation logic, or return the entire Entity name. But you would do it with an XFBR String rule. The code to call it is here that would go in your Cube View row, and an example function that will return the first 4 characters of the Entity parameter selected:
Hope this helps,
02-05-2024 08:51 AM
@MikeG Is it possible to reference to parameter? I would like to use only two start letters of the entity name which will be selected in a parameter. e.g.
I am selecting ES_123 as a entity in Entity parameter. Then i would like to in the next parameter , reference to this entity name and take only 'ES' from it to specify how the selection of the UD1 members should look like based on this ES. Hope it is clear.
01-23-2024 01:53 PM
Hi fc: MikeG's answer is quick, simple, and most likely effective based your problem statement. If you want to step into The General Problem territory, below is a custom member list function that can be used to go up/down based on a designated number of levels. I wrote this previously for going down, but was able to modify it to allow for going up as well; it should work for any dimension and would handle entities with different lengths but that still follow your 2 depth example.
This is a Finance Business Rule, of FinanceFunctionType.MemberList:
If args.MemberListArgs.MemberListName = "Level" Then
'Purpose: provides a function for returning member lists based on a "level" above/beneath the selected member
'Usage: any Cube View or Quick View where a arbitrary level of the dimension is desired
'Usage Example: A#IncomeStatement.CustomMemberList(ReplaceWithYourBrName, MemberListName=Level, Level=[2], Direction=[Up|Down])
'Get the level requested and initial member selected
Dim level As Integer
Dim validLevel As Boolean = Integer.TryParse(args.MemberListArgs.NameValuePairs.XFGetValue("Level", "0"), level)
Dim direction As String = args.MemberListArgs.NameValuePairs.XFGetValue("Direction", "Down")
'Force a valid direction
If Not ((direction = "Up") Or (direction = "Down")) Then
direction = "Down"
End If
'Member components needed for the return
Dim objMemberListHeader As New MemberListHeader(args.MemberListArgs.MemberListName)
Dim objMembers As New List(Of Member)
'Our starting point
objMembers.Add(args.MemberListArgs.TopMember)
'Check to ensure we received input
If objMembers IsNot Nothing Then
If Not validLevel Then 'user is messing with us so return where we started
Return New MemberList(objMemberListHeader, objMembers)
Else If level = 0 Then 'user wants to stay put
Return New MemberList(objMemberListHeader, objMembers)
Else If level < 0 Then 'user is messing with us so return where we started
Return New MemberList(objMemberListHeader, objMembers)
Else ' recursively loop until we hit final depth, checking for no data along the way
For nLevel = 1 To level
If objMembers IsNot Nothing Then 'check that we are not empty
Dim objMembersTemp As New List(Of Member)(objMembers) 'needed so we don't cause a recursive loop
For Each lMember As Member In objMembersTemp
objMembers.Remove(lMember) 'remove the old so don't create recursion
'Add the children/parents
If direction = "Down" Then
objMembers.AddRange(api.Members.GetChildren(args.MemberListArgs.DimPk,lMember.MemberId))
Else If direction = "Up" Then
objMembers.AddRange(api.Members.GetParents(args.MemberListArgs.DimPk, lMember.MemberId, False))
Else 'do nothing
End If
Next 'lMember
Else 'we've moved so far there are no children/parents, so return nothing
Return Nothing
End If
Next 'nLevel
'We are done looping through the members, so return the final list
Return New MemberList(objMemberListHeader, objMembers)
End If
End If
'Else something was bad with the user input so return nothing
Return Nothing
End If
You'd use it like this:
E#1010TRW.CustomMemberList(ReplaceWithYourBrName, MemberListName=Level, Level=[2], Direction=[Up])
Probably overkill for your need but another option with additional functionality.
Cheers, -db
01-25-2024 10:28 AM
thank you both for the help!