Hello
I've written an Velocity email Template. The following Number Field is displaying with a decimal place.
Incident Level: $issue.getCustomFieldValue("customfield_11513") is showing to one decimal place e.g. 4.0
How can I format this number to remove the decimal place. e.g. Just 4 instead of 4.0
?
Thanks
Sam
Hi Guys,
I've worked this one out -
$issue.getCustomFieldValue("customfield_xxxxx").toString().replaceAll(".0", "")
Thanks for this!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wish I could get this working for Date Pickers... they're all suffixed with a 00:00:00.0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I fixed this also, by first defining a variable, guessing I needed to escape the colons or something. #set( $notime = "00:00:00.0" ) $issue.getCustomFieldValue("customfield_xxxxx").toString().replaceAll($notime, "")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Needed to make a small adjustment to escape the . so it didn't replace things like 80
replaceAll("\.0", "")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe $number.format("#0","customfield_xxxxx") is better as the one above fails on two digits (e.g. 10.0) like it was using . as a single character wildcard. (I tried also 20.0)...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.