Brian Dunning's FileMaker Custom Functions

PercentDisplay ( Number )

Percent Formatting Display

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

Todd Dignan   Todd Dignan
Dignan Consulting
http://www.dignanconsulting.com

Share on Facebook Share on Twitter

  Sample input:
PercentDisplay (50)
  Sample output:
.50

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

This takes a whole number, 100 or less and converts the them in to a decimal. Any number over a 100 makes it a 100 percent.

 

Comments

Mark   Mark
Aug 14, 2014
I am new to this and need help. I have FMP 13 Advanced. Do I just paste this code into the Custom Function dialog?

I did that. I named the function "PercentageTrunc" and then pasted the above code into the calculation edit box. The result was "number" being greyed out and an error message came up saying "The specified parameter cannot be found."
 
Todd Dignan   Todd Dignan, Los Osos, CA
Aug 14, 2014
You do need to create this custom Function in the pulldown menu, File/Manage/Custom Functions..... Click the new button, Copy and paste the content into the custom function body. Give it the name of PercentDisplay, then give it the parameter of Number. Click ok to save the custom function. Then click ok to get out of the custom function manage window.

Goto to your calc, In top right "View" select custom functions. Double click on the function to add it to your calc. Then replace the word "Number" with a field or other calc that has a result as a number. Make sure your calc does have a result of number in the bottom left hand corner.

I hope this helps.

Todd Dignan
 
Mark   Mark
Aug 15, 2014
Thanks Todd- it worked until I went into Browse Mode to enter a value to test it.

Error message says: "This action cannot be performed because this field is not modifiable."

Is that solution in the Inspector (as with Find Mode or Browse mode behavior?)
 
Todd Dignan   Todd Dignan, Los Osos, CA
Aug 15, 2014
OK, You can NOT enter data into a calculation. You need to enter the value into another field and then reference that filed in the calculation with the custom function.

This should help.
 
Todd Dignan   Todd Dignan, Los Osos, CA
Aug 15, 2014
OR, you can use it in an auto enter calc and then you reference the function "self" in the custom function.
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: