Forum Discussion

AlvaroSR's avatar
AlvaroSR
New Contributor II
3 months ago

Display Text1 member property instead of name or description in cubeview

My client has member property Text1 in UD1 as a second description or alias, he wants to display Text1 instead of name or description. I tried with CV Function "u1#top.descendants.where(Text1 <> '')"...
  • TheJonG's avatar
    3 months ago

    You can use an XFBR rule. See script below. The member filter in the CV would be:

    u1#top.descendants.where(Text1 <> ''"):Name(XFBR(XFBR_Example, GetTextFieldForDescription, UD1Member = |MFUD1|))

    XFBR Rule:

     

    Imports System
    Imports System.Collections.Generic
    Imports System.Data
    Imports System.Data.Common
    Imports System.Globalization
    Imports System.IO
    Imports System.Linq
    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.DashboardStringFunction.XFBR_Example
    	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
    				If args.FunctionName.XFEqualsIgnoreCase("GetTextFieldForDescription") Then
    					
    					Dim ud1Member As String = args.NameValuePairs.XFGetValue("UD1Member","None")
    					Dim ud1MemberID As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId.UD1, ud1Member)
    					Dim ud1TextField As String = BRApi.Finance.UD.Text(si, dimTypeId.UD1, ud1MemberID, 1,Nothing,Nothing)
    					
    					Return ud1TextField
    				End If
    
    				Return Nothing
    			Catch ex As Exception
    				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    			End Try
    		End Function
    	End Class
    End Namespace