Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Math.FormatNumber
Formats a number.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Math | 11.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Value | The number to format. | 123 | |
Digits | Number of digits. Can be zero when there should be no digits after decimal separator. Default is zero. Maxium 12. Values are rounded. |
3 | Optional |
Decimal Separator | The decimal separator. If empty, we detect the current setting from FileMaker. Can also be explicitly given as "." or ",". |
"." | Optional |
Thousands Separator | The thousands separator. Can be empty. If you pass dot or comma and the same character is used for decimal separator, we switch to the other. |
Optional |
Result
Returns OK or error.
Description
Formats a number.We format the number and you can specify whether we use comma or dot as decimal separator or detect it automatically from FileMaker's settings.
Thousands separator can be given.
Examples
Format numbers:
MBS("Math.FormatNumber"; 123) & ¶ &
MBS("Math.FormatNumber"; 12,34; 2; ",") & ¶ &
MBS("Math.FormatNumber"; 0,001; 3; "") & ¶ &
MBS("Math.FormatNumber"; 123456789,1235; 3; ""; ".")
Example result:
123
12,34
0.001
123,456,789.124
Try negative numbers:
MBS("Math.FormatNumber"; -123) & ¶ &
MBS("Math.FormatNumber"; -12,34; 2; ",") & ¶ &
MBS("Math.FormatNumber"; -0,001; 3; "") & ¶ &
MBS("Math.FormatNumber"; -123456789,1235; 3; ""; ".")
Example result:
-123
-12,34
-0.001
-123,456,789.124
Try huge number:
MBS("Math.FormatNumber"; 1234567890123456789012345678901234567890,1234567890; 8; ","; ".")
Example result: 1.234.567.890.123.456.789.012.345.678.901.234.567.890,12345679
Format currency:
MBS("Math.FormatNumber"; $amount; 2; ","; ".") & " €"
Try various numbers:
MBS("Math.FormatNumber"; 12,3456 ; 3 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 6 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 9 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 10 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 11 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 12 ; "."; "" ) & ¶ &
MBS("Math.FormatNumber"; 12,3456 ; 20 ; "."; "" )
Example result:
12.346
12.345600
12.345600000
12.3456000000
12.34560000000
12.345600000000
12.34560000000000000000
Release notes
- Version 15.0
- Improved Math.FormatNumber function to work better with 11 or more digits.
- Version 11.1
- Added Math.FormatNumber function.
- Fixed problem in Math.FormatNumber with missing zero before decimal separator for small number.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 15.0pr8
- MBS FileMaker Plugin, June 2021 News
- MBS FileMaker Plugin 11.1
- Neues MBS FileMaker Plugin 11.1
- MBS FileMaker Plugin 11.1
- MBS FileMaker Plugin, version 11.1pr7
- MBS FileMaker Plugin, version 11.1pr5
This function is free to use.
Created 22nd January 2019, last changed 3th January 2025
