Quick Tip

Using Division in a Form Field

Lori Kassuba – December 13, 2011

Rating: button_print

There are several different ways to perform math functions within form fields in Acrobat. To show you these, I’ll enter form field edit mode in Acrobat X, by opening up the Tools pane, Forms panel, and clicking on the Edit menu. My AmountSubtotal field is a predefined calculation. So when I open up the Form Field Properties dialog and select the Calculate tab, you can see the predefined types of calculations. In this case I’m using the sum calculation for my sub-total field. However, if you need to divide certain types of form fields, you’ll need to either use Simplified Field Notation or JavaScript. I’ll review how you can use Simplified Field Notation to perform division. Simplified Field Notation is just a scripting language based on a syntax that's similar to the formulas that are written in spreadsheet programs.

So, to perform division, I’ll open up the Properties dialog of my SalesTax field, click on the Calculate tab, select the Simplified field notation radio button, and select Edit. In this case I’ll enter the fieldname AmountSubtotal multiplied by 6 and divided by 100. This is the sales tax amount in Michigan. Then, when I close the Properties dialog and click the Preview button, you can see the automatic calculation of the sales tax.

You cannot use hierarchical field names or spaces when using Simplified Field Notation. And be careful because division by zero can result with an answer like NaN - Not a Number or Infinity. You may also want to consider using a custom JavaScript calculation to avoid the Not a Number issue.

Play video

Interested in trying this for yourself?
Get Acrobat X trial now.

0 comments

Leave a reply:

Commenting is not available in this channel entry.
Ask a question on this topic