Forum Discussion

PKiernan's avatar
PKiernan
New Contributor III
4 years ago

Proper Case format in Cube View

Would like to modify the "UPPER" case descriptions in metadata to "Proper Case" in Cube Views. Any formatting options for this?

  • You can write a little xfbr function as a format helper

    Namespace OneStream.BusinessRule.DashboardStringFunction.Cubeview_ParamHelper
    	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("Upper") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Return text.ToUpper
    				End If
    
    				If args.FunctionName.XFEqualsIgnoreCase("Lower") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Return text.ToLower
    				End If
    
    				If args.FunctionName.XFEqualsIgnoreCase("TitleCase") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Dim myTI As TextInfo = New CultureInfo("en-US",False).TextInfo
    					Return myTI.ToTitleCase(text.ToLower)
    				End If
    
    				Return Nothing
    			Catch ex As Exception
    				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    			End Try
    		End Function
    	End Class
    End Namespace

    you need to call it like this:

    E#TOTAL.DescendantsInclusive:name(xfbr(Cubeview_ParamHelper, TitleCase, Text=|MFEntity|))

    The variables |MF<Dimtyepename>|  or |MF<Dimtyepename>Desc| (i.e. |MFEntity| or |MFEntityDesc|) will pass the name or description to the business rule.

    The .toLower is needed to force all upper strings to lower string, because the .ToTitelCase ignores all upper strings.

     

    I hope this helps, cheers

  • ChristianW's avatar
    ChristianW
    Valued Contributor

    You can write a little xfbr function as a format helper

    Namespace OneStream.BusinessRule.DashboardStringFunction.Cubeview_ParamHelper
    	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("Upper") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Return text.ToUpper
    				End If
    
    				If args.FunctionName.XFEqualsIgnoreCase("Lower") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Return text.ToLower
    				End If
    
    				If args.FunctionName.XFEqualsIgnoreCase("TitleCase") Then
    					Dim text As String = args.NameValuePairs("Text")
    					Dim myTI As TextInfo = New CultureInfo("en-US",False).TextInfo
    					Return myTI.ToTitleCase(text.ToLower)
    				End If
    
    				Return Nothing
    			Catch ex As Exception
    				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    			End Try
    		End Function
    	End Class
    End Namespace

    you need to call it like this:

    E#TOTAL.DescendantsInclusive:name(xfbr(Cubeview_ParamHelper, TitleCase, Text=|MFEntity|))

    The variables |MF<Dimtyepename>|  or |MF<Dimtyepename>Desc| (i.e. |MFEntity| or |MFEntityDesc|) will pass the name or description to the business rule.

    The .toLower is needed to force all upper strings to lower string, because the .ToTitelCase ignores all upper strings.

     

    I hope this helps, cheers

    • PKiernan's avatar
      PKiernan
      New Contributor III

      Awesome - Thanks Christian!! Works like a charm.