Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

AutoCurrency ( number )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.7  (23 votes)
  Discuss this Custom Function

Jeep Watson, Uptown Press
http://www.uptownpress.com

Auto Format Currency as you type

Sample Input:
123456
Sample Output:
$1,234.56


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Description:

I use this CF to automatically format currency as the user types in a number field. The decimal point is automatically entered (the last 2 digits are the cents). It is used in conjunction with an OnObjectModify script trigger attached to the numeric field. The script called by the trigger consists of only one line:

AutoCurrency ( Filter ( table::field ; "0123456789" ) )

Note the filter to strip out everything except numbers.

In Layout Mode: Do NOT select entire contents on entry
Also set up the Data Formatting panel as follows:

Format as Currency
Fixed number of decimals = 2
Symbol = $
Decimal = .
Use thousands separator = ,

Editing an already populated field is a little tricky but could be done by highlighting and changing one digit at a time. Frankly the function is so fast that it is simpler to just re-enter the whole number or backspacing to the point where the change is needed and re-entering the remainder.

MANY thanks to Daniele Raybaudi for lots of brilliant tips over the years including the use of the NumToJText function as a formatting tool.

Here’s a dropbox link to a demo file: https://www.dropbox.com/s/hx51ny67n6fdlp3/AutoCurrency.fp7?dl=0

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:

5 most recent comments | Show all 6 comments

Note that you have a problem when the last entered digit is a zero (or two zeros). This could be solved by using:

NumToJText ( Div ( number ; 100 ) ; 1 ; 0 ) & SerialIncrement ( ".00" ; Mod ( number ; 100 ) )

comment, VR
March 06, 2015 12:37pm

Sorry Michael, no disrespect to Agnes, I simply ran across a comment by Danielle in http://www.briandunning.com/cf/1707 that reminded me of this functionality.

Thanks for the input. I had forgotten about the SerialIncrement function. Over the years I have always appreciated your ability to create a solution using the simplest, most concise methods. Years ago you helped me reduce a long, verbose calculation I was using to create the Sum of the Digits for a checksum to a single line using the complementary Div and Mod functions.

I will amend this function with the proper attributions. Thanks again for your contributions over the years.

Jeep Watson, Baltimore
March 08, 2015 8:08am

People like you make my days so much better!

Thanks for sharing your work, I really appreciate this function.

Alejandro, Quito, Ecuador
February 22, 2016 4:45pm

When I use this function with a calculation, It comes out as $3,705.55 instead of $370,555.00. Seems like there should be a work around, but I'm brand new to custom functions.

Thanks!

Scott, El Paso
August 05, 2016 1:17pm

Scott, El Paso

I reactivated the dropbox link above. Download the demo file and see if it helps.

Jeep Watson, Baltimore, MD
August 05, 2016 2:32pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 8 + 8 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions