tholelesego Posted March 5, 2019 Share Posted March 5, 2019 How can I use the Pattern and Pattern Expression in the Textfield properties to reduce a java.lang.String value to have two decimal digits? Any assitance would be appreciated . Link to comment Share on other sites More sharing options...
hozawa Posted March 5, 2019 Share Posted March 5, 2019 Only number have "decimal" digits so you'll have to convert your String to some number. Link to comment Share on other sites More sharing options...
Solution prusyn Posted March 6, 2019 Solution Share Posted March 6, 2019 There are a bunch of approaches, which depend on your java knowledge. For example, expressions:A)String.format("%.2f", new BigDecimal(Double.parseDouble($F{sample})))[/code]B)new DecimalFormat("0.00").format(new Double($F{sample}))[/code]where $F{sample} is a field from dataset, that contains numbers. I used sample query: select '25.45060506506456' as sample[/code]Also, attaching report. 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