Proper Case format in Cube View

PKiernan
New Contributor III

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

1 ACCEPTED SOLUTION

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:

ChristianW_0-1639058305938.png

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

View solution in original post

2 REPLIES 2

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:

ChristianW_0-1639058305938.png

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
New Contributor III

Awesome - Thanks Christian!! Works like a charm.