Forum Discussion
- RobSnelsonNew Contributor III
I think in this instance, you would be best advised to use an XFBR rule to solve this challenge.
You can then specify the E#Entity.Base.Where(Text3 = 'Austria') as a parameter to pass into the XFBR, and then within the XFBR you can build a GetDataCell string that you return to the MemberFilter in the CV. In the rule you would create a Member List using the filter, and then cycle through each member in the list to build the string, adding up all the members.
XFBR(GetDataCellUsingFilter,Filter=E#Entity.Base.Where(Text3 = 'Austria'))
I believe there is a rule out there already, written by Nick Kroppe, that does this.
Hope this helps!
Archetype
- osanalystNew Contributor
I tried to use this business rule XFBR string but it doesn't work
Namespace OneStream.BusinessRule.DashboardStringFunction.CubeViewLists
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object
Try
'-- Example Usage XFBR(CubeViewLists,GetSumMemberFormula,DimName=[|WFEntityDim|],MemberFilter=[])
If args.FunctionName.XFEqualsIgnoreCase("GetSumMemberFormula") Then
Dim strMbrFilter As String = args.NameValuePairs("MemberFilter")
Dim strDimName As String = args.NameValuePairs("DimName")
Dim dpk As DimPk = BRApi.Finance.Dim.GetDimPk(si, strDimName)
If dpk Is Nothing Then
Throw New XFException(si, "Error, specified dimension does not exist", strDimName)
Else
Dim lstMI As List(Of MemberInfo) = brapi.Finance.Members.GetMembersUsingFilter(si, dpk, strMbrFilter, True )Dim strList As String = String.Join(" + ", (From l In lstMI Select "E#[" & l.Member.Name & "]").ToArray())
Return strList
End IfEnd If
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
End Class
End Namespace- RobSnelsonNew Contributor III
What error are you getting?
This code should work, it includes the GetDataCell and Name as an additional argument:
Namespace OneStream.BusinessRule.DashboardStringFunction.CubeViewListsPublic Class MainClassPublic Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As ObjectTryIf args.FunctionName.XFEqualsIgnoreCase("GetSumMemberFormula") ThenDim strMbrFilter As String = args.NameValuePairs("MemberFilter")Dim strDimName As String = args.NameValuePairs("DimName")Dim strName As String = args.NameValuePairs("Name")Dim dpk As DimPk = BRApi.Finance.Dim.GetDimPk(si, strDimName)If dpk Is Nothing ThenThrow New XFException(si, "Error, specified dimension does not exist", strDimName)ElseDim lstMI As List(Of MemberInfo) = BRApi.Finance.Members.GetMembersUsingFilter(si, dpk, strMbrFilter, True)Dim strList As String = String.Join(" + ", (From l In lstMI Select "E#[" & l.Member.Name & "]").ToArray())'XFBR(CubeViewLists,GetSumMemberFormula,DimName=[MainEntityDim],MemberFilter=[E#Legal_Consol.Base.Where(Text1 = 'Test')],Name=[Total])Return $"GetDataCell({strList}):Name({strName})"End IfEnd IfReturn NothingCatch ex As ExceptionThrow ErrorHandler.LogWrite(si, New XFException(si, ex))End TryEnd FunctionEnd ClassEnd Namespace
- ChristianWValued Contributor
Related Content
- 8 months ago
- 7 months ago
- 3 months ago