Is it possible to auto-format a number field in scriptrunner?
Ex:
Cap: 12.335 should be 12.34
Cap: 12.3 should be 12.30
Cap: 12 should be 12.00
Hi @Scott Federman
Can you try this and let me know if this works?
def cap = 12.335cap = ((float)cap).round(2)println cap
Thanks,Pramodh
If you really need that 0 after a decimal
Convert the number to string and append zero
how would i do that? would i need a text field vs number field?
Here it is @Scott Federman
Let me know if this works
def cap = 2.34cap = ((float)cap).round(2)cap = ((String)cap)str = cap.split("\\.");if (str[1].length() == 1) cap = ((String)cap) + "0"println cap
Thanks
It looks like you're new here. Sign in or register to get started.