Display float type with two digits after decimal in list view

zacktackett5
Kilo Contributor

Question as above. I am trying to display a float type number on a list view with two digits after the decimal, as in the JavaScript toFixed(2). Is there any way this can be done without changing the type of variable on the table?
Thanks in advance!

1 ACCEPTED SOLUTION

HarshTimes
Kilo Sage

Hi Zack,What is the current type of the field?You can set that if you have the type decimal.


"open the dictionary entry for the field by right-clicking the decimal field label and selecting 'Personalize -> Dictionary'. Once there, you'll need to adjust both the 'Max length' and 'Attributes' fields as shown below.The decimal places are a combination of 'Max length' and the 'scale' attribute. If you want 4 decimal places, you'll need a 'Max length' of 4 plus the default of 15, or 19. Your 'scale' attribute would be set to 4, to indicate the number of decimal places. 6 decimal places would require a max length of 21 and a scale attribute of 6, and so on."


You can find more details on SNCGuru, Check the link https://www.servicenowguru.com/system-definition/controlling-decimal-field-places/



View solution in original post

2 REPLIES 2

HarshTimes
Kilo Sage

Hi Zack,What is the current type of the field?You can set that if you have the type decimal.


"open the dictionary entry for the field by right-clicking the decimal field label and selecting 'Personalize -> Dictionary'. Once there, you'll need to adjust both the 'Max length' and 'Attributes' fields as shown below.The decimal places are a combination of 'Max length' and the 'scale' attribute. If you want 4 decimal places, you'll need a 'Max length' of 4 plus the default of 15, or 19. Your 'scale' attribute would be set to 4, to indicate the number of decimal places. 6 decimal places would require a max length of 21 and a scale attribute of 6, and so on."


You can find more details on SNCGuru, Check the link https://www.servicenowguru.com/system-definition/controlling-decimal-field-places/



HarshTimes
Kilo Sage

HI Zack


Please mark this as answered if this has resolved your queries



Regards,


Harsh