Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Decimal numbers and locale of the user

janmarcin
Kilo Contributor

Hello there,

I have a question regarding the way of working with decimal numbers in decimal fields. Since that SNOW can use different way for settings the locale value (taken from sys_properties/user profile/browser settings) there can be various way to display decimal number. Actually I am facing the problem where my system locale decimal separator is "," and thousand separator " ". When I want to read the value from the decimal field I use g_form.getDecimalValue() which takes into account the locale of the user and basically converts the display number to javascript decimal number where decimal separator is "." (dot) Then I need to do some calculations and then set the calculated value back to different decimal value but taking to account locale, which means to convert the decimal value to comma separated decimal places. Here I didn't find any way how to convert the javascript decimal value to the display value of the current user (as an example I used decimal separator comma but I need this dynamic so it can be "." or ",") I would need something like g_form.setDecimalValue() but nothing like this exists + it should work in the Service portal as well.

Do you have any idea how can I set the decimal value in the format of locale for the user?

thanks for your help,

Jan

2 REPLIES 2

Kavita9
Tera Contributor

Hi Jan,

 

I am facing same issue. Did you find any solution so far?

 

Thanks

Kavita

Samson Fulop
Tera Contributor

Hi,

Same problem here.

Currently I'm using string replacement, but that's just a lazy and overall bad ideea.

Did you find any solution so far?

 

Regards,

Samson