Brian Dunning's FileMaker Custom Functions

AddComma ( number ; digits )

Put a comma in the specified number of digits.

  Average rating: 4.6 (25 votes) Log in to vote

fukky   fukky

Share on Facebook Share on Twitter

  Sample input:
AddComma ( 1000 ; 3 )
  Sample output:
1,000

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

number の指定した 桁数毎に カンマを付けて返す。
Put a comma in the specified number of digits.

 

Comments

Richard S. Russell   Richard S. Russell, Madison, Wisconsin, USA
May 17, 2017
You'll probably want to fiddle with this a bit to get commas only in the integer part of the number (to the left of the decimal point).
 
Richard S. Russell   Richard S. Russell, Madison, Wisconsin, USA
May 18, 2017
After posting the above comment about the decimal part of the number (not intended to have commas inserted in it), I decided to take a shot at it myself. Here's what I came up with (calling fukky's AddComma function to deal with the integral part of the number):

CommaCozzy

ANumber
DigitGroup

Let ( [
PureNumber = GetAsNumber ( ANumber );
IntegralPart = Int ( PureNumber );
DecimalPart = PureNumber - IntegralPart
] ;

AddComma ( IntegralPart; DigitGroup ) &
If ( DecimalPart > 0; GetAsText ( DecimalPart ); "" )

)
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.