12-08-2021 06:08 PM - last edited on 05-23-2023 09:35 AM by JackLacava
Would like to modify the "UPPER" case descriptions in metadata to "Proper Case" in Cube Views. Any formatting options for this?
Solved! Go to Solution.
12-09-2021 09:05 AM
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
12-09-2021 09:05 AM
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
12-09-2021 03:08 PM
Awesome - Thanks Christian!! Works like a charm.