Utilizing toFix()

57 views
Skip to first unread message

Randy Flinn

unread,
Jul 28, 2025, 9:12:43 AM7/28/25
to Bill Crews, mementodatabase
I recently saw information you provided in July 2023 (Bill’s Mementos) regarding use of toFix(2).

Number instance methods

  • toFixed(#)

    • To set a Number value to a specific number of decimal points, type one of the following…

n = n.toFixed(2); // Round the value of n to 2 decimal digits of precision

n = n.toFixed(); // Round the value of n to an integer value (same as n.toFixed(0))


I am fairly new to JavaScript so can you assist me with if this works with iOS version and where the script is placed to run?  I am trying to set up numeric values to two decimal places in the screen below (I.e., 483.00 vs 483, 36.00 vs 36, etc.)


Any help would be appreciated.


David Gilmore

unread,
Jul 28, 2025, 11:02:20 AM7/28/25
to mementodatabase
That is standard Javascript syntax, so it should work.

However, I have found that not all Javascript works the same between iOS, PC, and Android. The three environments do not use the same exact Javascript engine obviously, so some things may not be in one or the other environments (especially true for newer Javascript capabilities). And on my Android phone, the Javacript engine for different apps that support Javascript are also different.

The best thing to do is to do a quick test, and ensure it works like you expect on your device.

Bill Crews

unread,
Jul 28, 2025, 11:55:25 AM7/28/25
to Randy Flinn, mementodatabase
One quick example would be a JavaScript field when the field could reference another number field (Integer, Real, Currency, etc) and say to set the value of the JavaScript field to have 2 decimal digits. The script might be...

field("Price").to fixed(2);  //Change field name to yours
Reply all
Reply to author
Forward
0 new messages