Skip to main content
Participant
January 2, 2020
Answered

Help with rounding mileage calculation

  • January 2, 2020
  • 1 reply
  • 478 views

I am using AEM Designer.  Created a form to calculate mileage.

Form Calc Formula is "Miles" x .575.

I used round to go to two decimals, but it does not round up; i.e. 11 miles x .575  = $6.33, but only shows $6.32 in the calculations.  We are government and need to reimburse by rounding up.  Ideas how to help?

 

This topic has been closed for replies.
Correct answer Thom Parker

If you are using JavaScript there is an easy way to round a calculation value.

 

var nValue = 11*0.575;

var nRounded = util.printf("%0.2f",nValue);

 

1 reply

scarbrdAuthor
Participant
January 2, 2020

11 x 5.75 = $6.325, which is $6.33 rounded.

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 2, 2020

If you are using JavaScript there is an easy way to round a calculation value.

 

var nValue = 11*0.575;

var nRounded = util.printf("%0.2f",nValue);

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often