This is a migrated thread and some comments may be shown as answers.

Tabular Currency Alignment for Negative and Positive Numbers

5 Answers 17 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 26 Dec 2019, 06:15 PM
We have reports that show dollar amounts and discounts for services in a table.  The discounts are negative numbers with a financial format that puts them in ().  In the attachment, the columns of numbers going from positive to negative are not aligned.  Is there a way to handle this so the numbers (regardless of being positive or negative) are aligned vertically?

5 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 31 Dec 2019, 11:04 AM

Hi Steven,

The requirement can be achieved with Padding set with Conditional Formatting or Bindings, or with special invisible symbols. I have attached a report demonstrating both approaches. Next, I will describe them briefly.

1. Padding

I have used Bindings in the 'Base Rate' column of the table to set the Right Padding to '1.8mm' when the displayed value is non-negative, and to 0 otherwise - check the screenshot 'PaddingWithBindings.png'. This way, the additional ')' character in negative values was compensated with padding to allow for the numbers to be aligned. Note that with this approach when changing the Font it may be necessary to change also the padding.

2. Invisible character.

You may also use the Format Text function and add an additional invisible symbol after the numbers for the non-negative values. Importantly, we trim the regular whitespace, so it will be necessary to choose another invisible symbol. I used the space character "U+2004 | &#8196 | Three-Per-Em Space" - check Unicode empty characters, where I copied the symbol from. This approach is demonstrated in the table column 'Service Fee'. Here is the Value for the TextBox:

= IIF(Fields.[Service Fee] >= 0,
        Format("{0:c2}{1}", Fields.[Service Fee], ' '),
        Format("{0:c2}", Fields.[Service Fee]))

The {1} parameter is replaced with the 'Three-Per-Em Space' character to compensate for the ')' symbol in the negative values.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Steven
Top achievements
Rank 1
answered on 02 Jan 2020, 03:23 PM
Thank you for this.  I am using an older version of Reporting so I cannot open your example report. Can you reply with the expression used in the Binding?
0
Todor
Telerik team
answered on 06 Jan 2020, 03:44 PM

Hi Steven,

Here is the Binding for setting the right padding:

Property path			|	Expression
Style.Padding.Right	|	= IIf(Fields.[Base Rate] >= 0, '1.8mm', '0mm')

I am re-attaching the TRDX report converted to R1 2018. It can be opened with the specified or newer version of the Standalone designer. If you need the sample in an even older version just open the TRDX file in a text editor and change the schema on the second row to the one corresponding to the version - check XML Schema article section and Upgrade Path.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
nitish
Top achievements
Rank 1
answered on 14 Jul 2020, 08:27 PM
i have also a website name invisible character <a href="theinvisiblecharacter.com">invisible character</a>
0
nitish
Top achievements
Rank 1
answered on 14 Jul 2020, 08:28 PM
https://www.theinvisiblecharacter.com/
Tags
General Discussions
Asked by
Steven
Top achievements
Rank 1
Answers by
Todor
Telerik team
Steven
Top achievements
Rank 1
nitish
Top achievements
Rank 1
Share this question
or