Scope: All Acrobat versions
Skill Level: Beginner
Prerequisites: Familiarity with Acrobat Professional
Acrobat provides three options for creating form-field calculations:
To enter a calculation:
The first option on the Calculate tab is for the predefined calculations. To use this option, simply select one of the calculations from the drop-down list, click on the Pick… button and select the fields to be used as inputs (Figure 2).
The predefined calculations are rather limited, for example, there is no division or subtraction. The simplified field notation allows the creation of much more complex calculations. It uses a notation similar to how a calculation would ordinarily be written, i.e., using the regular math symbols, + (addition), -(subtraction), *(multiplication) and /(division). Field names are used as operands. In the example file the equation:
D = (A + B)/C
is calculated by entering (Figure 3)
(Calc2_A + Calc2_B) / Calc2_C
Where Calc2_A, Calc2_B, Calc2_C are the names of text fields
This notation is limited to calculations that only use the standard four math operators. It also does not handle form field names that include punctuation or spaces. Special characters are, in fact, the main reason calculations using this method fail, so let me repeat the restriction again. Simplified field notation cannot operate on any field name that includes spaces or punctuation.
event.value = ( this.getField("Calc2_A").value + this.getField("Calc2_B").value ) / this.getField("Calc2_C").value;
The first thing to notice is that the calculated value is assigned the variable event.value. The value of this variable is assigned to the field when the calculation is completed. All calculation scripts must assign a value to the event.value variable. The second thing to note is that the input field values are explicitly acquired. Take for example the input value
|Convert existing forms to fillable PDFs fill and sign any formEdit PDF create PDF Action Wizard|
Try Acrobat DC
Get started >
Post, discuss and be part of the Acrobat community.
Join now >