Skip to main content
carolynd25828304
Participant
July 26, 2018
Answered

Help with writing a formula in javascript - reimbursement for mileage

  • July 26, 2018
  • 3 replies
  • 956 views

I am working on an itemized expense form and need to track mileage.  I am trying to enter a formula that will add each of the columns for miles and then multiply that total by the .545 standard mileage rate.  Any help would be appreciated.  Below is a portion of the document I am working on.  I only need assistance with the totals for the Mileage.  Thank you!

Dates:

TOTALS:

Breakfast

($15.00 max)

Lunch

($20.00 max)

Dinner

($30.00 max)

Registration

Airfare

Hotel/Lodging

Rental Car

Transportation

Parking

Mileage (# of miles x standard IRS rate)

Other

(Explain below)

Explanation of other charges: _______________________________________________________________________

Funding Acct Number: _____________________________________________________

Total expenses:

This topic has been closed for replies.
Correct answer try67

See: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

You can use the first option described in that tutorial for the sum, and the second (Simple Field Notation) for the product of the total by a fixed value. I recommend using field names without spaces, or you'll need to escape them in the latter.

3 replies

carolynd25828304
Participant
July 27, 2018

Thank you so much for the response.  I was able to make it work by using the "simplified field notation" and entering the formula below:

0.545*(Mileage1 + Mileage2 + Mileage3 + Mileage4 + Mileage5 + Mileage6)

Thom Parker
Community Expert
Community Expert
July 26, 2018
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 26, 2018

See: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

You can use the first option described in that tutorial for the sum, and the second (Simple Field Notation) for the product of the total by a fixed value. I recommend using field names without spaces, or you'll need to escape them in the latter.