12-13-2023 09:14 AM - edited 12-13-2023 09:15 AM
Hi Team,
I am trying to create an Input CubeView with an expansion based on whether the 'Allow Input' setting is set to True for our UD5 Dimension Members.
To give a little bit of background, we are using the UD5 dimension for our Customer Codes. The setup is based on the different regions (which have their own cube) and the basis of the structure is captured under 'Customers'. The regions can have the flexibility to add more detail by adding members under this basis structure in their dimension:
We have an Input CubeView that is currently set to .Base (from the dimension that belongs to the Cube we are inputting for). However, a member might be a Base member in one dimensions (however, we don't want and cannot input here), but a parent member in the other. That is why I am trying to create an expansion based on the Allow Input setting. However, when I try "Member.Base.Where(AllowInput=True) it is unfortunately not working.
Does anyone have any idea how we can solve this (or maybe if we can suppress these members)?
Thank you in advance!
Solved! Go to Solution.
12-13-2023 10:36 AM - edited 12-13-2023 10:46 AM
Hi @Rianne
You can create a custom member list to do this for you. The code below should do the trick.
Create a Finance Business Rule (this one is called 'MY_CustomMemberList' and the member list is called 'Customers' you can rename these to what ever you like)
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
Imports System.Linq
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports OneStream.Finance.Database
Imports OneStream.Finance.Engine
Imports OneStream.Shared.Common
Imports OneStream.Shared.Database
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Wcf
Imports OneStream.Stage.Database
Imports OneStream.Stage.Engine
Namespace OneStream.BusinessRule.Finance.MY_CustomMemberList
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 Is = FinanceFunctionType.MemberListHeaders
Dim objMemberListHeaders As New List(Of MemberListHeader)
objMemberListHeaders.Add(New MemberListHeader("Customers"))
Return objMemberListHeaders
Case Is = FinanceFunctionType.MemberList
If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("Customers") Then
'Example: U5#Root.CustomMemberList(BRName=MY_CustomMemberList, MemberListName=[Customers])
'Prepare Member List Header & List of Member Infos
Dim memberListHeader As New MemberListHeader(args.MemberListArgs.MemberListName)
Dim memberList As New List(Of Member)
Dim d As [Dim] = api.Dimensions.GetDim("Customers")
Dim UD5BaseMembers As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(d.DimPk, "U5#Customers.Base")
'Loop through each member and only add if AllowInput = True
For Each m As MemberInfo In UD5BaseMembers
If api.UD5.AllowInput(m.Member.MemberId) Then
memberList.Add(m.Member)
End If
Next
'Return Member List
Return New MemberList(memberListHeader, memberList)
End If
End Select
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
End Class
End Namespace
Call the custom member list in your cube view using the following:
U5#Root.CustomMemberList(BRName=MY_CustomMemberList, MemberListName=[Customers])
Regards,
Mark
12-13-2023 10:36 AM - edited 12-13-2023 10:46 AM
Hi @Rianne
You can create a custom member list to do this for you. The code below should do the trick.
Create a Finance Business Rule (this one is called 'MY_CustomMemberList' and the member list is called 'Customers' you can rename these to what ever you like)
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
Imports System.Linq
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports OneStream.Finance.Database
Imports OneStream.Finance.Engine
Imports OneStream.Shared.Common
Imports OneStream.Shared.Database
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Wcf
Imports OneStream.Stage.Database
Imports OneStream.Stage.Engine
Namespace OneStream.BusinessRule.Finance.MY_CustomMemberList
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 Is = FinanceFunctionType.MemberListHeaders
Dim objMemberListHeaders As New List(Of MemberListHeader)
objMemberListHeaders.Add(New MemberListHeader("Customers"))
Return objMemberListHeaders
Case Is = FinanceFunctionType.MemberList
If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("Customers") Then
'Example: U5#Root.CustomMemberList(BRName=MY_CustomMemberList, MemberListName=[Customers])
'Prepare Member List Header & List of Member Infos
Dim memberListHeader As New MemberListHeader(args.MemberListArgs.MemberListName)
Dim memberList As New List(Of Member)
Dim d As [Dim] = api.Dimensions.GetDim("Customers")
Dim UD5BaseMembers As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(d.DimPk, "U5#Customers.Base")
'Loop through each member and only add if AllowInput = True
For Each m As MemberInfo In UD5BaseMembers
If api.UD5.AllowInput(m.Member.MemberId) Then
memberList.Add(m.Member)
End If
Next
'Return Member List
Return New MemberList(memberListHeader, memberList)
End If
End Select
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
End Class
End Namespace
Call the custom member list in your cube view using the following:
U5#Root.CustomMemberList(BRName=MY_CustomMemberList, MemberListName=[Customers])
Regards,
Mark