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

Division in Text field Properties - Help

TF_Devlin
Registered: May 23 2008
Posts: 4

You can do multiplication and addition in the Calculate tab under Text Field Properties. Does anyone know how to set it up for taking 2 form fields and dividing them?

Thanks.

My Product Information:
Acrobat Pro 8.1.2, Macintosh
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi TF_Devlin,

Under the Calculate tab use Simplfied Field Notation instead. Click on Edit and enter your exact field names with a divide dash-

FieldName1/FieldName2

Hope that helps,

Dimitri
WindJack Solutions
www.windjack.com
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You can use the "/" operator in the "Simplified field notation" or the "Custom calculation script" fields on the "Calculate" tab.

George Kaiser

TF_Devlin
Registered: May 23 2008
Posts: 4
I put in this

Penetration 3/Penetration 2


in the simplified field notation, is that right. I am not getting it to work.

Thanks for your help.
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi TF_Devlin,

You need to remove the spaces between the letters and numbers in your field names and in the Simplified Field notation section of the calculate tab. Spaces are not a good idea for field naming and in fact won't work with Simplifed Field Notation.

Penetration3/Penetration2

Hope this helps,

Dimitri
WindJack Solutions
www.windjack.com
jonchalk
Registered: Dec 15 2007
Posts: 8
I followed Dimitri's suggestion by using the formula in the "simplified field notation" area, however, I am getting the following error: "the value entered does not match the format of the field [fieldname]".

What I am doing is creating a formula to do a pro-rata calculation.

ie: payment amount of $1000.00. 4 accounts with varying amounts (10,000.00 + 20,000.00 + 15,000.00 + 9,000.00 = 54,000.00). I should be seeing a percentage that is pro-rated for each balance and then an exact figure of the amount to be applied to each balance. The total percentages should equal 100%. Another error occurred: the 1st "percentage" field resulted in the wrong percentage (I have created a spreadsheet to do the same and the spreadsheet is correct, but I wanted to create a PDF version to allow others in my work area that do not have a spreadsheet to perform pro-rata calculation with ease). Yet another error appeared: the total percentage should have equalled 100%, but equalled 104%. I believe that the 1st error may be behind the subsequent errors.

How do I correct this?

I wish I can attach my PDF I created to show you, but I am unable to find a button to upload a PDF on this forum.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
If you are performing a division, the most likely cause of this error is attempting to divide by zero. Whenever the denominator is based on a field value or could otherwise possibly be zero, you should not use simplified field notation. Using JavaScript will allow you to test for a denominator of zero and take appropriate action.

The reason this particular error happens with a field that has a numeric Format category is due to the result of the calculation not being a finite number (absolute value less than 999,999,999,999,999,934,464). When a field is blank, it will (usually) be considered equal to zero. Dividing by zero will result in a value of +Infinity, -Infinity, or NaN (Not a Number, 0/0), depending on the sign and value of the numerator. Since any of these values will not be allowed in a field with a numeric Format category, you will get that error. The fix is to use a custom calculation script using JavaScript.

If you need help with the appropriate JavaScript to use, please supply more details about the calculation you need to perform.

George
smb221
Registered: Nov 22 2008
Posts: 1
I am having that very problem that you have just described (NaN error. I have fields that have simple calculations set and when the form is blank and I tab through it keeps giving me errors.) Here is a rundown:

I am performing calculations in several different fields (lets say fields "A","B", and "C"). They are calculated by using these fields (lets say fields "1","2",and "3") divided by one common field (lets say field "common"). For example:

A = 1/Common
B = 2/Common
C = 3/Common

The problem I am having is that when I am tabbing through filling out my form and I get an error message saying "NaN" until I insert "Common". I want my form to not freak out if there is no "Common" yet. Sometimes I don't need the calculation to be performed at all, in which case I will leave the "Common" field blank, and I would like to get rid of the error message. Is there a script that says:

"Do not perform calculation in Field A,B,and C unless a value has been entered into to Field Common"?

Any help would be appreciated.

Thanks
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
See this: http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=16803