Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Custom number format - is there a description ?
icon5.gif  Custom number format - is there a description ? [message #630014] Thu, 30 September 2010 11:45 Go to next message
Anatoly  is currently offline Anatoly Friend
Messages: 10
Registered: September 2010
Junior Member
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 16:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 16:44 Go to previous message
Anatoly  is currently offline Anatoly Friend
Messages: 10
Registered: September 2010
Junior Member
Thank you, Jason, it works !
Previous Topic:BIRT Viewer 2.5.1 ISSUE
Next Topic:system requirment for BIRT Envirnment
Goto Forum:
  


Current Time: Wed Nov 26 14:16:20 GMT 2014

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

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