greg.sears Posted June 8, 2023 Share Posted June 8, 2023 Is it possible to dynamically change the pattern used for formatting numbers? In my scenario, we are batch printing many invoices at once. The numeric formatting is based on the location of the recipient of the each invoice. This location is part of the result set of data. If Invoice #1 is from US then the format should have standard US formatting with the period used from decimal place and comma for digit grouping (#,##0.00). However, if Invoice #2, in the same batch, has a Location of EU, then the format should change to a comma for decimal place and a period for digit grouping (#.##0,00). I can't change the Locale because the pattern could change based on the Location of the recipient. Any assistance would be appreciated. Link to comment Share on other sites More sharing options...
Mehak Rajkumar Posted June 12, 2023 Share Posted June 12, 2023 Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times. Link to comment Share on other sites More sharing options...
Jivan Phadtare Posted June 12, 2023 Share Posted June 12, 2023 Hello,It looks like without changing locale, it's difficult to dynamically change the pattern used for formatting numbers.We found similar below community article where similar situation was encountered.https://community.jaspersoft.com/questions/518137/dynamic-double-patternMight be this article help you however, we request you to log a feature request for your idea. Link to comment Share on other sites More sharing options...
greg.sears Posted June 14, 2023 Author Share Posted June 14, 2023 I was able to solve as follows:String.format(new java.util.Locale($V{Locale}), "%.2f",$F{INVOICEAMOUNT} )I can pass the Locale from the DB query and it will change along with the appropriate record. 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