Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Custom Calculation Scrip
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Custom Calculation Scrip

 Post Reply Post Reply
Author
tninja24 View Drop Down
New Member
New Member
Avatar

Joined: 02 Nov 2011
Points: 2
Post Options Post Options   Quote tninja24 Quote  Post ReplyReply Direct Link To This Post Topic: Custom Calculation Scrip
    Posted: 02 Nov 2011 at 5:23pm
New to custom calculations..need help!

Need to do a simple division calculation, with the result being a percentage.  More specifically, I need to divide data in text field "Text1" by 8, and then show the result as a percentage.  Any support is greatly appreciated!

T
Back to Top
Sponsored Links


Back to Top
tninja24 View Drop Down
New Member
New Member
Avatar

Joined: 02 Nov 2011
Points: 2
Post Options Post Options   Quote tninja24 Quote  Post ReplyReply Direct Link To This Post Posted: 02 Nov 2011 at 8:01pm
Never mind.  I discovered I can compute the calculation using a simplified field notation rather than creating a custom calculation script.  In case anyone is curious, my simplified field notation is:

Text1 / 8

Additionally, you must check "percent" in the format tab to convert the calculation into a percentage.  Very easy.

Thank You!

Back to Top
zippidi View Drop Down
New Member
New Member


Joined: 13 Dec 2015
Location: Burgas
Points: 1
Post Options Post Options   Quote zippidi Quote  Post ReplyReply Direct Link To This Post Posted: 13 Dec 2015 at 10:44am

Brilliant answer. I have been pulling my pubes out for an hour trying to get a percentage to display correctly. Thank you

Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4078
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 13 Dec 2015 at 4:05pm
That is fine for division by a non-zero divisor. If your dividend and divisor are field values and the divisor could have a zero or null value, you calculation will fail because division by zero will result in a value of "NaN" or not a number and throw a format error. Also division of a very small number by a very large number can through a format error since it is possible the value exceeds the displayable value for a 16 bit floating point number and is formatted in scientific notation.

Is such cases one must check the value of the divisor or the result of the division and this will require the use of a custom JavaScript.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.014 seconds.