Change Decimal to 4 decimal

TashfiqueH
Tera Contributor

I have a table thats imported from excel. I want to change the data thats already on the table to 4 decimal place. How can i do it? the field is in decimal. Thank you

1 ACCEPTED SOLUTION

Juhi Poddar
Kilo Patron

Hello @TashfiqueH 

  • I don't think we can change the already existing data in 2 decimal place to 4 decimal place.
  • However we can do the field configuration for new inputs.
  • To change the number of decimal place you will have to navigate to the configure Dictionary of that field.

Change the max length and attribute as shown in the screenshot:

JuhiPoddar_0-1736925849876.png

The decimal places for a field are a combination of the max length attribute setting and the scale attribute. By default max length is 15 and it hold 2 decimal space. 

For example, if you want four decimal places for the field, you need a max length attribute setting of 4, plus the default of 15 or 19. You would set the scale attribute to 4 to indicate the number of decimal places. Six decimal places require a max length setting of 21, a scale attribute setting of 6, and so on.

 

Note:  Increase the max length attribute to a value greater than 15 to increase this attribute. It is mandatory to change the max length. 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

 

View solution in original post

4 REPLIES 4

Bhavya11
Kilo Patron

Hi @TashfiqueH ,

 

To achieve this combination of Max length for the field and the scale attribute .Could you please refer this article

 

 

If this helped please like and mark it as an accepted solution. 

 

Thanks,

BK

 

 

 

Thanks,

BK

Juhi Poddar
Kilo Patron

Hello @TashfiqueH 

  • I don't think we can change the already existing data in 2 decimal place to 4 decimal place.
  • However we can do the field configuration for new inputs.
  • To change the number of decimal place you will have to navigate to the configure Dictionary of that field.

Change the max length and attribute as shown in the screenshot:

JuhiPoddar_0-1736925849876.png

The decimal places for a field are a combination of the max length attribute setting and the scale attribute. By default max length is 15 and it hold 2 decimal space. 

For example, if you want four decimal places for the field, you need a max length attribute setting of 4, plus the default of 15 or 19. You would set the scale attribute to 4 to indicate the number of decimal places. Six decimal places require a max length setting of 21, a scale attribute setting of 6, and so on.

 

Note:  Increase the max length attribute to a value greater than 15 to increase this attribute. It is mandatory to change the max length. 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

 

Ankur Bawiskar
Tera Patron
Tera Patron

@TashfiqueH 

ensure you update the field map or use onBefore transform script to convert that field to 4 decimal places.

Run the transform again and it will override the value for that column keeping other data intact.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Runjay Patel
Giga Sage

Hi @TashfiqueH ,

 

you can glide record on your table to get the list of record and update it like below

parseFloat(current.amount).toFixed(4);

 

you can use background or fix script to update the value.