Brian Dunning's FileMaker Custom Functions

Fixed_DecimalDigits ( Num ; DecCount )

format a number to a predefined number of decimal digits - recursive

  Average rating: 4.1 (34 votes) Log in to vote

Antonios M. Kesmetzis   Antonios M. Kesmetzis

Share on Facebook Share on Twitter

  Sample input:
Fixed_DecimalDigits ( 12,01 ; 4 )
Fixed_DecimalDigits ( 12,01345 ; 4 )

  Sample output:
12,0100

12,0134

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

/* AnKe
Skopelos Island, Greece
March 2009

This function is recursive
It formats a number to a predefined number of decimal digits
It lDOES NOT round the number in case less decimal digits than those of the number are specified
It simply ignores digits beyond the specified number
i.e. Num = 1 and DecCount = 3 Result is 1,000
Num = 1,01235 and DecCount = 4 Result is 1,0123
It is therefore useful when one needs to add trailing zeroes to the decimal part of a number

Comma "," is used as decimal point; it can be changed to dot "."

It has been developed to send FileMaker data to a database that uses fixed length fields
*/

 

Comments

abonino   abonino, M├╝nchenbuchsee
Apr 7, 2010
work not with swiss-date-format "."
;-(
 
victor   victor, norristown pa
Nov 7, 2013
i need to set the number of decimal points in a field that is based on the value of another field in the same record. example: the number of decimal points in the field 'upper range' needs to be the number specified in the 'decimal places' field. i am using filemaker 10 pro advanced. thank you in advance!!
 

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.