08-08-2023 04:28 PM
My rows are my UD3 Dimension, and I want to mimic a current Excel Report. I want to Left Justify the Description and right justify the UD3 Name so it basically looks like this.
Boys garments B100
Mens garments B110
I have this Name function to reverse the Description and Name.
U3#Root.List(B100, B110):Name(XFMemberProperty(DimType=UD3, Member=|MFUD3|, Property=Description)XFMemberProperty(DimType=UD3, Member=|MFUD3|, Property=Name))
Based on that I get
Boys garmentsB100
Mens garmentsB110
Of course I could add some spaces, but I have Descriptions that vary greatly.
I just wanted to make sure I wasn't missing a statement could make the Member Name property to Right Justify. Any ideas appreciated, otherwise I just get the users to accept it in Name Description format.
08-08-2023 07:05 PM
There are no justify options available in formatting row or column headers in Cube Views, that I am aware of. It would be nice if you could center as well.
08-09-2023 08:32 AM
Following the screen shots below will get you close. You would have to play with some formatting to get the Nested Member Expansion 2 (i.e., the Description) to be right justified.
08-09-2023 09:00 AM - edited 08-16-2023 06:38 PM
Here's a way:
in the member filter property of the row, call an XFBR in the Name function that will format your member they way you want it., add leading spaces, proportionally add padding between description and name, anything you want.
The part before the colon will not appear in the row header, but WILL drive the values in the data cells for that row. This means you can create any row header you want in the XFBR.
a#60999:Name(XFBR(RightLeftJustify, Justify, HeaderCellWidth=80,headerCellText=60999 - Net Sales,DimName=Account))
VB.net
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 Return Justify(si, args) Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function Private Function Justify(ByVal si As SessionInfo, ByVal args As DashboardStringFunctionArgs) As String Dim output As String = String.Empty Try Dim dimName As String = args.NameValuePairs.XFGetValue("DimName", String.Empty) Dim headerCellText As String = args.NameValuePairs.XFGetValue("headerCellText", String.Empty) Dim headerCellWidth As Integer = Convert.ToInt32(args.NameValuePairs.XFGetValue("HeaderCellWidth", String.Empty)) Dim parts As String() = headerCellText.Split("-"c) Dim firstPart As String = parts(0).Trim() Dim secondPart As String = parts(1).Trim() Dim spacesCount As Integer = headerCellWidth - firstPart.Length - secondPart.Length Dim spaces As String = New String(" "c, spacesCount) output = firstPart & spaces & secondPart Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try Return output End Function End Class
C#:
public class MainClass { public object Main(SessionInfo si, BRGlobals globals, object api, DashboardStringFunctionArgs args) { try { return Justify(si, args); } catch (Exception ex) { throw ErrorHandler.LogWrite(si, new XFException(si, ex)); } } private string Justify(SessionInfo si, DashboardStringFunctionArgs args) { string output = string.Empty; try { string dimName = args.NameValuePairs.XFGetValue("DimName", string.Empty); string headerCellText = args.NameValuePairs.XFGetValue("headerCellText", string.Empty); int headerCellWidth = Convert.ToInt32(args.NameValuePairs.XFGetValue("HeaderCellWidth", string.Empty)); string[] parts = headerCellText.Split('-'); string firstPart = parts[0].Trim(); string secondPart = parts[1].Trim(); int spacesCount = headerCellWidth - firstPart.Length - secondPart.Length; string spaces = new string(' ', spacesCount); output = firstPart + spaces + secondPart; } catch(Exception ex) { throw ErrorHandler.LogWrite(si, new XFException(si, ex)); } return output; } }