Brian Dunning's FileMaker Custom Functions

FormatAsPrice ( input ; separator ; currency ; Leading_1 )

text formatting

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

Fabrice Nordmann   Fabrice Nordmann
1-more-thing
https://www.1-more-thing.com

Share on Facebook Share on Twitter

  Sample input:
FormatAsPrice ( ,3 ; "." ; "$" ; 1 )
FormatAsPrice ( ,329 ; "," ; " €" ; 0 )
  Sample output:
$0.30

-0.33 €

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

Format a number as a real life pricestamp, to display on your layouts.

 

Comments

Lisa Clark   Lisa Clark, Santa Cruz CA
Jul 8, 2014
Would love eto have this put in a thousands separator if the amount is > or = to 1000.
And two separators it the amount is >= 1 million.
 
Ann Goggin   Ann Goggin, Portland ME
Aug 5, 2015
Can someone give an example that shows how to separate a number (example $1234) with the comma to denote thousands ($1,234)?
Thank you!
 
Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Aug 5, 2015
If it's for display only, the inspector allows you to choose the thousands separator. (Data inspector)
If you want to do it by calculation to insert it in a text, it's a little bit more difficult.
A hack is to use the layout formatting (as explained above), name the field object and get it's content using GetLayoutObjectAttribute ( "objectName" ; "content" )

Better is the use of NumToJText function:
NumToJText ( yourNumberHere ; 1 ; 4 )
 

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.