Forum Discussion
RobbSalzmann
2 years agoValued Contributor II
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; } }
Related Content
- 6 months ago
- 2 years ago
- 5 months ago
- 2 months ago