Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Home
- >
- Acrobat SDK
- >
- Percentage calculation

Percentage calculation

New Here
,

Apr 29, 2018

Copy link to clipboard

Copied

I need to enter the calculations on a .pdf form and I am having trouble getting the percentages to work.

I have a Property Value (field 4.3) then a Borrowers Equity (field 4.6) and then a Percentage of Equity (field 4.7)

What Java Script would I use to get the percentage to come out correctly (example 20.0%)

TOPICS

Acrobat SDK and JavaScript,
Windows

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Percentage calculation

New Here
,

Apr 29, 2018

Copy link to clipboard

Copied

I need to enter the calculations on a .pdf form and I am having trouble getting the percentages to work.

I have a Property Value (field 4.3) then a Borrowers Equity (field 4.6) and then a Percentage of Equity (field 4.7)

What Java Script would I use to get the percentage to come out correctly (example 20.0%)

TOPICS

Acrobat SDK and JavaScript,
Windows

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

marshan6205178

Apr 29, 2018
0
/t5/acrobat-sdk/percentage-calculation/td-p/9830015
1
Reply
1

gkaiseril
LATEST

Adobe Community Professional
,

Apr 29, 2018

Copy link to clipboard

Copied

What is the problem you are having?

I would start by reviewing the Acrobat JavaScript tutorials abut performing calculations and acquainting myself with the syntax for Acrobat JavaScript.

How to do (not so simple) form calculations by Thom Parker

I would them make sure the fields I am going to use have the correct formatting for the expected type of input or write some custom validation. I would set field 4.3 and 4.6 to have a format of Number with the appropriate number of decimal places. For field 4.7 I would use the Percentage format.

Acrobat provides 3 methods for entering calculations. The first one is for selecting fields to perform a specific calculation but division is not one them, so the method is not available.

Them there is the Simplified Field notation that uses just the field names and assumes you are using the value of the fields or a constant value. This method requires a specific field naming convention and the first requirement is that all field names start with an alphabetic character. Since your field names do not follow this requirement, you cannot use this method.

The last option is to use the Custom JavaScript code to write the script. To use a field's value one needs to get the field object by the field name and them use the value property. The example computes the decimal of the sum of 2 numbers divided by a third number. This is very similar to the calculation for computing a percentage when the result field is set to the Percentage format. The result of this calculation will give one a value that can be used without any conversion in any other calculation, It is the decimal value used for the Percentage. Acrobat forms uses the Percentage format to only change the displayed value. If one needs the result to be limited to to 3 decimal places, one for display purposed, then one will need to add a founding function.

Note you you may have to deal with division by a divisor with a value of zero or near zero..

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Reply

Loading...

gkaiseril

Apr 29, 2018
0
/t5/acrobat-sdk/percentage-calculation/m-p/9830016#M22580
Using the Community
Experience League
Terms of Use
Privacy Policy
Cookie preferences
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語コミュニティ
- Português

Copyright © 2020 Adobe. All rights reserved.