Home
Analytics
Custom Percent Format - No Percent Symbol
dbmathis
Hi All,
I am using version 3.7.2 and I need a custom percent format (no percent symbol). I have noticed that when I use a custom format, it seems that adding the % to the custom format affects the way the decimal is handled.
For example if I use ##0.0% 1234.56 becomes 123456.0%, which is what I want, minus the % sign.
Using ##0.0 simply produces 1234.6
What I am looking for is a format string that produces 123456.0, and also considers negative numbers which would produce -123456.0 for -1234.56.
I have the 3rd edition field guide and have searched Google but can't find this information in either place. Does anyone know how to accomplish the formatting I am looking for or perhaps a resources that explains how this is done?
Best Regards
David
Find more posts tagged with
Comments
kclark
Take a look at <a class='bbc_url' href='
http://www.birt-exchange.org/org/devshare/designing-birt-reports/711-birt-dynamic-number-formatting/'>this
devshare</a> and let me know if it helps with what you're trying to do.
dbmathis
Thanks, but I am not sure this answers my question.
The percent sign itself seems to control the (decimal * 100) behavior (if applied in the GUI or in a text field). The problem is when I remove the % symbol that I don't want in the format the number is treated like a general number rather than a percent. I was able to work around the issue by multiplying the binding by 100 and using a fixed format.
I was hoping that someone could provide me with a resource that explains in depth the formatting syntax and specifically how to format a percentage without a percentage symbol.
Best Regards
David
kclark
David,<br />
You could format the number then in the onCreate() do something like this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.java.text);
pf = new NumberFormat.getPercentInstance();
this.setDisplayValue(pf.format(this.getValue()).replace("%",""));
</pre>
<br />
Which should remove the %