2002 JI Open Discussion Posted August 31, 2006 Share Posted August 31, 2006 By: gabyem - gabyem Number format 2005-03-07 11:33Hello! I am building a report with iReport and Jasper Report. It works fine but I cant change the numbers to use '.' as decimal separator and ',' as thousand separator. I tryed changing the pattern and it did not work. I changed the regional settings on the computer and it did not work either. I will appreciate any help! Thanks By: allie - allie910 RE: Number format 2005-06-13 20:39Hi There, sorry, but are u sure u are using the right pattern ? I'm using #,##0.00 and it's working fine with me =) The way that i'm showing a bigecimal variable using a textfield and set the value class of the textfield as : java.math.BigDecimal and set the pattern to the textfield as well ;) hope this can help u By: Giulio Toffoli - gt78 RE: Number format 2005-06-14 07:54Please note that #,##0.00 is Locale indipendent, so in Italy the result of: #,##0.00 will be: 1.234,56 Giulio Link to comment Share on other sites More sharing options...
hopesolutions Posted March 18, 2008 Share Posted March 18, 2008 It doesn't seem to work.I am developing a java application on an italian server, but want numbers to come in english format, and i keep getting wrong formatting.i want 1,234.56 but i get 1.234,56. i passed to jasper the parameter REPORT_LOCALE as desired but it seems the JasperReports 2.0.4 doesn't use it to format the numbers. the problem is that in iReports exports it is correct, only the web generated pdf is wrong. I checked here but they all suggest using custom java classes or scriptlets to do this, but is there a way to make this with default jasper reports features and locales ?? Thanks Link to comment Share on other sites More sharing options...
momzilla Posted March 24, 2008 Share Posted March 24, 2008 textfield expression/string Code:NumberFormat.getInstance().getCurrencyInstance(Locale.ITALIAN).format($F{somenumberfield})+" / "+NumberFormat.getCurrencyInstance(Locale.US).format($F{somenumberfield}) Link to comment Share on other sites More sharing options...
extendet Posted December 10, 2009 Share Posted December 10, 2009 Hi hope. There is one questionable way, if u'r using JRTextField to display this amount. :)U say u want 1,234.56 instead of 1.234,56. If u can get the amount(1,234.56) as a String(by changing the field's Expression Class to java.lang.String), u can simply call replace(String, String) in the Text Field's Expression. But in order to keep the amount formating u got to use also DecimalFormat(only if u'r thousand separator is space). So this 'workaround' looks something like this:DecimalFormat.getInstance().format($F{AMOUNT}).replaceFirst(",", ".")Or something like that. good luck! Link to comment Share on other sites More sharing options...
mfoglino Posted January 29, 2010 Share Posted January 29, 2010 if $F{ImporteTotal} is a BigDecimalTry with this (in the Text Field Expression):($F{ImporteTotal}).setScale(2)That's working for me.saludosmarcos Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now