Skip to main content



      Home
Home » Archived » BIRT » Custom number format - is there a description ?
icon5.gif  Custom number format - is there a description ? [message #630014] Thu, 30 September 2010 07:45 Go to next message
Eclipse UserFriend
I need to format my float column in table as "XXX XXX XXX." (When the value is 3123977.12 i want to see "3 123 977.")

I can easy get "3,123,977." (format as Custom, format code "###,###."), but when i change "," in format code to any other symbol - it don't work as 1000's separator, only adds to end of number ("###+###." create "3123977.+", "### ###." create "3123977. ").

Is there a full description of format number code masks ?

Thank you !
Re: Custom number format - is there a description ? [message #630113 is a reply to message #630014] Thu, 30 September 2010 12:23 Go to previous messageGo to next message
Eclipse UserFriend
Anatoly,

Take a look at:
http://download.oracle.com/javase/1.4.2/docs/api/java/text/D ecimalFormat.html

The , is the grouping separator and will be used in the US locale but
will be replaced if you use French locale.

You can always replace the grouping separator in script as well. Select
the data item or aggregation element and create the following onRender
Script:

var aggval = this.getValue();

importPackage(Packages.java.text);
unusualSymbols = new DecimalFormatSymbols(reportContext.getLocale());
unusualSymbols.setDecimalSeparator('.');
unusualSymbols.setGroupingSeparator(' ');

patt = "###,###.00";
myForm = new DecimalFormat(patt, unusualSymbols);
myForm.setGroupingSize(3);

mystr = myForm.format(aggval);

this.setDisplayValue(mystr);

Jason


On 9/30/2010 7:45 AM, Anatoly wrote:
> I need to format my float column in table as "XXX XXX XXX." (When the
> value is 3123977.12 i want to see "3 123 977.")
>
> I can easy get "3,123,977." (format as Custom, format code "###,###."),
> but when i change "," in format code to any other symbol - it don't work
> as 1000's separator, only adds to end of number ("###+###." create
> "3123977.+", "### ###." create "3123977. ").
>
> Is there a full description of format number code masks ?
>
> Thank you !
Re: Custom number format - is there a description ? [message #630450 is a reply to message #630113] Sat, 02 October 2010 12:44 Go to previous message
Eclipse UserFriend
Thank you, Jason, it works !
Previous Topic:BIRT Viewer 2.5.1 ISSUE
Next Topic:system requirment for BIRT Envirnment
Goto Forum:
  


Current Time: Sat Jul 05 07:03:41 EDT 2025

Powered by FUDForum. Page generated in 0.04107 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top