Skip to main content
cynbee3162
Participant
July 8, 2019
Answered

Formula help: adding up mileage fields then multiplying by .58 cent reimbursement rate.

  • July 8, 2019
  • 1 reply
  • 2781 views

It woked - then when I saved .pdf it was lost when I reopened it.  Then it would only work in some fields an not others.  Now it won't work at all.

// Get first field value, as a number

var v1 = +getField("MileagemilesRow1").value;

// Get second field value, as a number

var v2 = +getField("MileagemilesRow2").value;

// Get third field value, as a number

var v3 = +getField("MileagemilesRow3").value;

// Get fourth field value, as a number

var v4 = +getField("MileagemilesRow4").value;

// Get first field value, as a number

var v5 = +getField("MileagemilesRow5").value;

// Calculate and set this field's value to the result

event.value = .58 * (v1 + v5);

This topic has been closed for replies.
Correct answer cynbee3162

Where is your problem?

(0.0 + 0.0) * 0.58 is 0.0


Thank you for all your help.  There was a duplicate formula in another cell (which I had inadvertently copied) that was causing the problem.  But you had easier formulas to use.  Thank you, again!!!

1 reply

Bernd Alheit
Community Expert
Community Expert
July 9, 2019

You can use the simplified field notation:

(MileagemilesRow1 + MileagemilesRow5) * 0.58

October 31, 2019

I am having a similar issue, what am i doing wrong? with how I have it configured, it does not calculate the field AUTO: Mileage 1.0. I have 100 entered so it should calculate to $28 (100 miles x 0.28) but the value is $100.

 

*screenshot is attached, i cannot get it to upload

 
 
try67
Community Expert
Community Expert
October 31, 2019

the formula for the mileage field is: Mileage * 0.28 in the Simplified field notation

the calculation in the TOTAL field is set to: Value is the sum (+) & all fields under Auto are selected.

 

Is there a way I can upload my document to you? This is my first created form using Adobe so I really appreciate your patience.


That doesn't make sense. You can't use a field's own value in its calculation.

That's like using this formula:

x = x + 5