Forum Discussion

Satish's avatar
Satish
New Contributor II
5 months ago

Have to pass Entity filter in Cubeview rows which should bring only en which as text property

Hi,

i have request to pass the Entity filter in rows in cubeview but it should bring members which as text property.

for ex: i am using text4 property for few entities and i want to bring only those entities in the cubeview. is there any way please.

Please suggest if anyone as came across this requirement.

Thanks in Advance

  • db_pdx's avatar
    db_pdx
    Valued Contributor

    You are probably after Where clause expansions. You can do this directly in the cube view row block...no need for a custom business rule to replicate standard functionality.

    Member Expansion Example:

    E#Root.Base.Where(Text4 Contains 'YourProperty')

     

  • MarcusH's avatar
    MarcusH
    Contributor III

    I think a custom member list is what you need. There is an example in GolfStream. I have changed the code so that it should do what you want. Change myText4String to the string you want to search for.

    Imports System
    Imports System.Data
    Imports System.Data.Common
    Imports System.IO
    Imports System.Collections.Generic
    Imports System.Globalization
    Imports System.Linq
    Imports Microsoft.VisualBasic
    Imports System.Windows.Forms
    Imports OneStream.Shared.Common
    Imports OneStream.Shared.Wcf
    Imports OneStream.Shared.Engine
    Imports OneStream.Shared.Database
    Imports OneStream.Stage.Engine
    Imports OneStream.Stage.Database
    Imports OneStream.Finance.Engine
    Imports OneStream.Finance.Database
    
    Namespace OneStream.BusinessRule.Finance.MemberLists
    	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("MemberList1"))
    						Return objMemberListHeaders
    						
    					Case Is = FinanceFunctionType.MemberList
    						'Example: E#Root.CustomMemberList(BRName=MyBusinessRuleName, MemberListName=[Sample Member List], Name1=Value1)
    						If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("MemberList1") Then
    							Dim objMemberListHeader As New MemberListHeader(args.MemberListArgs.MemberListName)
    							Dim objMemberInfos As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(args.MemberListArgs.DimPk, "E#Root.Base.where(Text4 = myText4String)", Nothing)
    							Dim objReturnMembers As New List(Of MemberInfo)
    							For Each objMem As MemberInfo In objMemberInfos
                                    objReturnMembers.Add(objMem)
    							Next
    							Return objReturnMembers
    						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