These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Division

GLUW
Registered: Mar 3 2010
Posts: 7

Please help!

I am working with Adobe Pro 9. I am trying to divide 2 numbers and then I need the result to show as percentage.

I have typed

BudgetRow33_2/BudgetRow39_2

in the Simplified Field Notation. I changed the format to percentage. If the form has values it works but if I erase the values it will not.

Thanks

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
How can it work if there are no values to use for the calculation?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Be careful, and empty field can be treated as a zero value.

And the result for division by zero is?

Do you receive any error messages?

I get "The value entered does not match the format of the field [Field Name]".

If you change the format of the field, you will see that the field gets a value of "NaN", or a message that the result is "Not a Number".

If you enter any positive number into 'BudgetRow33_2' and leave 'BudgetRow39_2' or enter zero, I get 'Infinity' for the answer. And using a negative number in 'BudgetRow33_2' I get '-Infinity'.

Maybe you need to make sure you are not trying to divide by zero or a null value. And since the Simplified Field Notation does not support logical test, you will have to write a custom calculation script.

George Kaiser

GLUW
Registered: Mar 3 2010
Posts: 7
I get the message"the value entered does not match the format of the field". I was afraid the problem was null value.When I emptied the fields. Could you please help me with the custom calculation script? I have read about it buy I cannot figure it out.
Thanks
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
There is a problem when trying to divide by a null value or trying to divide by zero.

You need to enter the code into the "Custom calculation script" box by clicking the "Edit" button next to the box and entering the following code into the pop-up editor window:
// default result valuevar quotient = "";// get divisor valuevar divisor = this.getField('BudgetRow39_2 ').value;// test divisor for a zero or null valueif( divisor != 0) {// get dividend valuevar dividend = this.getField('BudgetRow33_2 ').value;// compute quotient valuequotient = dividend / divisor;}// set field value with result of divisionevent.value = quotient;

George Kaiser

GLUW
Registered: Mar 3 2010
Posts: 7
Thank you soooo much. I will try that!
GLUW
Registered: Mar 3 2010
Posts: 7
It worked!
Thanks gkaiseril!
jenarseneault
Registered: Oct 28 2011
Posts: 2
I am using this script in my form, but i'm still getting the error message that reads "The value entered does not match the format of the field [field name] when i click on a totally different field on the form. For example; i have a form that has some check boxes to select which location you would like to buy. Then in a totally different place on the form it has calculation fields that calculate the cost of your purchase. When I click on one of the check boxes, the error comes up for the field that is the total balance field of the calculations field. I can't figure it out. please help!

Jenifer

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Have you changed the field format to 'None' and observe what then appears in the field.

Are you sure all of the fields used in the calculation are numeric values and not texts fields that look like numbers?

Are any of the fields really large or small, this will force the value to be restated in scientific notation or display the result as "Infinity' or '-Infinity" any of these numeric values are treated as text fields in a form field.

Having a sample of the form could be helpful.

George Kaiser

jenarseneault
Registered: Oct 28 2011
Posts: 2
how do i get you a sample of the form?

Jenifer