FormatNumberComplete ( number, format )
Rate this function: Average rating: 3.7 (7 votes) Discuss this Custom Function
Lewis C. Lorenz, Lorenz Companies
www.LorenzCom.com/software
Returns text string of number in the requested format. Function allows complete FileMaker Pro number formatting using an intuitive format structure.
Sample Input:
FormatNumberComplete ( 14725.3675, “$,.2 US” )
FormatNumberComplete ( -14725.3675, “$(,.2) US\r0\” )
FormatNumberComplete ( -14725.3675, “#,.\c255\” )
FormatNumberComplete ( 1, “Yes\/No” ) = |
|
Sample Output:
$14,725.37 US
$(14,725.36) US [rounding off]
#-14,725.3675 [text color is red]
Yes |
|
Description:
FormatNumberComplete ( number, format )
Returns text string of number in the requested format.
by Lewis C. Lorenz
11-11-2011 Created
11-15-2011 Modified
number = number to format.
format = format string.
Function allows complete FileMaker Pro number formatting using an intuitive format structure. Inclusion, and placement, of the following characters in the format string controls the resulting formatted number string.
Number formatting.
, (comma/thousands separator) = integer portion of the number is "thousands separated".
. (period/decimal point) = controls display of the number decimal when used in conjunction with included, or omitted, # (number).
# (number) = controls the count of digits of the number decimal to display (also specifies the rounding precision):
0 = Number decimal and decimal point is not displayed. Enables positioning of negative signs and notations.
1 ... n = Truncation and rounding precision of the number decimal.
"" = Decimal point with no number displays the unaltered number decimal.
Negative signs control the formatted result of negative numbers. The signs listed below are in order of precedence. Any lower-precedence signs also in the format string are ignored during processing and do not appear in the formatted result. Minus sign, credit and delta symbols can be displayed on the left or right of the formatted number by placing them to the left or right of an included decimal point in the format string. Negative signs will be placed at their default location when no decimal point is included.
- = Minus sign (default). Default position is at the left.
<> = Angle brackets. Surrounds the number.
() = Parentheses. Surrounds the number.
CR = Credit symbol. Default position is at the right.
∆ = Delta symbol. Default position is at the left. (Darkened triangle is used.)
Boolean formatting.
\/ = escaped fore-slash divides boolean results. Left side is returned if number is true, right side is returned if number is false.
Percent, currency and other notations can be placed on either side of the formatted number depending on whether you place them at the left or right of an included decimal point in the format string. Notations will be placed at their default position when no decimal point is included.
% = Percent sign. Inclusion in format string forces multiplication of the number by 100 during processing. Default position is at the right.
$, #, etc. = Dollar and pound signs, and other characters, can be included in your formatted number. Default position is at the left.
Escaped characters can be used to override defaults and add formatting. Enclose each passed option in an ending escape (backslash).
\T = thousands separator. Default is , (comma).
\D = decimal point. Default is . (period).
\R = Round to passed precision (default is true).
\Z = Show number if zero (default is true).
\F = Fill decimal with zeros to length of passed precision (default is true).
\SL = Negative sign to appear on left side of number (default is minus sign).
\SR = Negative sign to appear on right side of number.
\NL = Notation to appear on left side of number.
\NR = Notation sign to appear on right side of number.
\PL = Proximity of negative sign on left side of number (default is next to number).
\PR = Proximity of negative sign on right side of number (default is next to number).
\C = Comma separated RGB number string to return colored negative number.
Examples:
FormatNumberComplete ( 14725.3675, "$,.2 US" ) = $14,725.37 US
FormatNumberComplete ( -14725.3675, "$(,.2) US\r0\" ) = $(14,725.36) US [rounding off]
FormatNumberComplete ( -14725.3675, "#,.\c255\" ) = #-14,725.3675 [text color is red]
FormatNumberComplete ( 1, "Yes\/No" ) = Yes
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
This is my Custom Function and I want to
edit it
Discuss:There are no comments yet. Be the first to post a comment about this Custom Function! Please try to keep it brief & to the point. Anyone can post:
|
Newest Custom Functions:
| 1. |
FilteredPortalList ( fieldObjectName ; portalRow ) |
| |
(Tue, May 21, 5:33pm) |
| 2. |
ListToggle ( InList ; InValue ) |
| |
(Thu, May 16, 6:59pm) |
| 3. |
VatFormat ( vat ) |
| |
(Tue, May 14, 2:45am) |
| 4. |
CheckVatBE ( vat ) |
| |
(Tue, May 14, 2:32am) |
| 5. |
CheckIBAN (IBAN ) |
| |
(Tue, May 14, 2:24am) |
| 6. |
OrcidCheckDigit ( Orcid_id ; Result ; Iterations ) |
| |
(Wed, May 08, 1:44am) |
| 7. |
DateRangeBySpan ( Begin ; End ; Term) |
| |
(Mon, May 06, 6:53am) |
| 8. |
Convert_Arabic_to_Chinese( number ) |
| |
(Thu, May 02, 6:10am) |
 |
|