surumi Posted July 28, 2006 Share Posted July 28, 2006 Are there any way to create a custom field pattern? For example, I want to create a Field Pattern that will format the value of a field with decimal places that is variable. The decimal is depending on the passed parameter/or configured value. Example: Field Value: 1.12341234 DECIMALPLACES: 4 Pattern: #,##0.{DECIMALPLACES} Output: 1.1234 Example: Field Value: 1.12341234 DECIMALPLACES: 1 Pattern: #,##0.{DECIMALPLACES} Output: 1.1 I was looking into the documentation but unable to find an answer. I was looking for any guide that will give me initial step to create my cutom field pattern. Thank you. Link to comment Share on other sites More sharing options...
teodord Posted July 28, 2006 Share Posted July 28, 2006 Hi, The pattern property of a text field in JR can be used to put DecimalFormat patterns as specified in the JDK documentation. But you could have the text field display String values that you format yourself using a special formatter that you can pass as a report parameter and then use in all text field expressions that need it. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
surumi Posted July 28, 2006 Author Share Posted July 28, 2006 teodord wrote:Hi,The pattern property of a text field in JR can be used to put DecimalFormat patterns as specified in the JDK documentation.But you could have the text field display String values that you format yourself using a special formatter that you can pass as a report parameter and then use in all text field expressions that need it.I hope this helps.Teodor Hi Teodor, Thanks for the reply. I am interested in the second paragraph but I don't get it. How could I create a special formatter? Are there any interface that I need to implement? And how do I pass it as report parameter? Or are there any way that I can build my own set of formatter, and associated it with tools like iReport, and deploy the library with JasperReports? Again, thank you so much for your time. 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