2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 By: Yaddif - yaddif Number Format 2006-03-27 13:59Hi Friends, I have a problem with the number format at Jasper. It is not taken the "regional setting" from Linux. I want to the numbers be shown as : 333,333.33 but when I run jasper at linux it shows : "333.333,33" :(. How can i force the jasper (with a function or something) in order to shows the number as the way that I want without care the server where it is running? (This problem was happened in Java too, but I solved using the DecimalFormat with the US Locale, but i dont know how apply this in Jasper). Thanks in advance. By: Sanjeev Saha - sanjeevsaha RE: Number Format 2006-03-27 14:082 approaches: 1) Create your own formatter class that takes in the desired parameters and returns the required format. Import this class in your jasper report and use it as any other java class while displaying the values. 2) Use the Jasper scriptlet support. You can checkout an example of how to do this by downloading the jasper reports source, in the demo/samples/scriptlet folder. hth, Sanjeev By: Lucian Chirita - lucianc RE: Number Format 2006-03-28 08:25Hi If the default Java locale is not good for you, you can set the REPORT_LOCALE parameter to any explicit value at fill time and the number format will be created for the specific locale. HTH, Lucian By: Yaddif - yaddif RE: Number Format 2006-03-28 08:19Thanks Sanjeev for your help. I think that the best option is the first because i can centralized my format function(for all my reports), but do you have some examples for import my class (and execute my method) inside the jasper xml file?... because i remember that i tried to do this but I couldn't. Thanks again for your help. Yaddif. By: Sanjeev Saha - sanjeevsaha RE: Number Format 2006-03-28 08:34If you were to build the report as a jrxml, then you'll need the import entry to identify the formatter class: <import value="x.y.z.NumberFormatter" /> Now, inorder to actually use this class, a simple example could be: <variable name="some_value" class="java.lang.String"> <variableExpression><![CDATA[NumberFormatter.format($F{filed_name})]]></variableExpression> </variable> You get the idea ;-) hth, Sanjeev 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