Forum Discussion

ZAH's avatar
ZAH
New Contributor
3 years ago

Member Constraints

Hello all . 

 

i am trying to display in a cubeview a list of accounts with specific constraints related to FLow , for example i want to display Only accounts with having Flow = EQU . any idea which function to use ? i tried the [Where] clause

it didnt work out. would the [Option] be helpful ? which arguments should i pass 

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    Hi ZAH,

    Sorry, you are on the right track... have you tried passing the argument of FlowConstraint?

    • ZAH's avatar
      ZAH
      New Contributor

      Hello Nicolas, 

      i tried this: A#M_BS.Base:Name(XFMemberProperty(DimType=Account, Member=|MFAccount|, Property=FlowConstraint)

      it displays the flowconstraint for all BS accounts . i want to be able to select Accounts having EQU flow only . in sql it is very easy. but in OS i having difficulty finding the correct function to pass such a filter on .

      • NicolasArgente's avatar
        NicolasArgente
        Valued Contributor

        It might be easier if you use an XFBR formula. Do you need the indentation in your cube view? as you will loose that by default in the XFBR!

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    You would do something like this into a Dashboard XFBR String :
       If (args.FunctionName.XFEqualsIgnoreCase("GetFlowConstraints")) Then
       ' Return Me.GetFlowConstraints(si, globals, api, args)\
    And then the formula could be : 

     

    		 Public Function GetFlowConstraints(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As String
                         Try
                                         
                    'Get the Dim PK for Accounts Dimension
                    Dim AccountsDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si,"DIMAccount")
                    'Get the member name of the account
                    'Get a list of BS accounts
                    Dim memFilterAccounts As List(Of MemberInfo) = BRAPi.Finance.Members.GetMembersUsingFilter(si, AccountsDimPk, "A#BS.Base.Where(InUse = True)", True)
                    'Use a text builder to build a string
                    Dim acMemberList As New Text.Stringbuilder()
    '                Dim isfirstItem As Boolean = True
                                'Loop through the assigned accounts and return the first account in the list
                                For Each account As MemberInfo In memFilterAccounts
            
    '                                If Not isfirstItem Then
             Dim accountConstraints As String = BRApi.Finance.Account.GetConstraintMemberForDimType(si,account.Member.MemberId,dimTypeid.Flow,-1).ToString
             Dim selectedConstraint As String = args.NameValuePairs.XFGetValue("FlowTable").ToString
             
             If accountConstraints = selectedConstraint Then
    '                                Else
                                        acMemberList.Append("A#")
                                     acMemberList.Append(account.Member.Name)
    '                                End If
    '                             isfirstItem = False
             End If
            Next 
                     
                     
                    'log
                    'Brapi.errorlog.LogMessage(si,acMemberList.ToString)
    
                    Return acMemberList.ToString
                                                
            Catch ex As Exception
                Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
            End Try      
     End Function

     

     tbh i have not tested 🙂

    And you can read that too : https://community.onestreamsoftware.com/t5/Accepted-Code-Samples/Dashboard-XFBR-String/ta-p/6611