Form Properties: Calculate
The Calculate Properties are specific to the Text Box and Dropdown fields. They enable a field to be calculated based on the contents of other fields in the document. The calculation is invoked whenever the value of the appropriate fields change.
Note: Calculations are performed on fields with obvious numeric values, even if they are combined with text, so long as the numbers are grouped. For example, Revu can extract the numeric value from entries like 123Text and Text123, but would likely have trouble getting the desired value from entries like T1e2x3t or 123Text123.
Value Is Not Calculated: This is the default calculation type. It means no calculations will be made.
Calculation Field: Selecting Calculation Field from the drop-down box to make simple calculations based on the contents of the other fields in the PDF.
- Sum(+): This selection will sum the selected fields.
- Product(x): This selection will multiply the selected fields.
- Average: This selection will take the average of the selected fields.
- Minimum: This selection will take the smallest value of all the selected fields.
- Maximum: This selection will take the largest value of all the selected fields.
Simplified Field Notation: Specify the Simplified Field Notation to make more complicated arithmetic calculations. The following is an example of a Simplified Field Notation calculation where a result is being calculated for the "ResultsTextBox" form field from values found in other fields on the form:
ResultsTextBox = AverageEmployeeSalaryTextBox * NumberOfEmployeesTextBox + TotalEmployeeBonusTextBox -TotalTaxesTextBox
Note: In the example above, only the calculation part of the equation (that is, what is shown to the right of the equals (=) sign) would be entered in the calculation field for the "ResultsTextBox" form field. Entering the product of the equation (that is, what is shown to the left of the equals (=) sign) would create an error as the "ResultsTextBox" field would be trying to use itself in its own calculation, which is paradoxical. It is not necessary to include the equals (=) sign itself either; it is implied.
this.getField("ResultsTextBox").value = this.getField("AverageEmployeeSalaryTextBox").value * this.getField("NumberOfEmployeesTextBox").value + this.getField("TotalEmployeeBonusTextBox").value - this.getField("TotalTaxesTextBox").value
var amplitude = new Number(this.getField("AmplitudeTextBox").value);
var period = new Number(this.getField("PeriodTextBox").value);
var phaseShift = new Number(this.getField("PhaseShiftTextBox").value);
var verticalShift = new Number(this.getField("VerticalShiftTextBox").value);
var x = new Number(this.getField("XTextBox").value);
event.value = verticalShift + amplitude * Math.sin(period * x + phaseShift);