These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calculation

mickc
Registered: Nov 21 2009
Posts: 6
Answered

Hi am new to calculations,
Iam trying to fill in an expenses form for my work ,

(no1) i need to divide the number of private miles by

(no2)the average miles to the gallon to give me the amount of fuel used for private mileage,

then multiply the amount of gallons used by the price per gallon to arrive at the sum i owe the company.

hope you can help

Mick

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
Have you looked at [url=http://www.acrobatusers.com/tutorials/2006/form_calculations]How to do (not so simple) form calculations[/url]?

The division operator is '/' and can be used in the simplified field notation and the custom javascript calculation options.

George Kaiser

mickc
Registered: Nov 21 2009
Posts: 6
hi
Thanks for the prompt reply, this is the code i have in now, i just need to know the rest so i can work out the amount of fuel i have to pay for.
hope this makes sense, i can send you the form if you like.


var v1 = +getField("total miles").value;
var v2 = +getField("miles per gallon").value;

event.value = (v2 !== 0) ? (v1 / v2) : "";var v1 = +getField("total miles").value;
var v2 = +getField("miles per gallon").value;

event.value = (v2 !== 0) ? (v1 / v2) : "";