Hello:
I am a new member. I am in the process of designing a Form with calculated fields. In one of the calculations a given number (in another field) has to be multiplied by 2 and then Rounded Up to the closest 1,000.
For example:
63,250 X 2= 126,500 and then rounding to the nearest 1,000, the result should be 127,000. How can I accomplish this in custom calculation?
I would appreciate any and all help. Thank you very much.
var quantity = 63250;
var price = 2;
var result = quantity * price;
console.show();
console.println("Extended value: " + result);
result = result / 1000; // shift decimal by 1000
console.println("Shifted value: " + result);
result = Math.round(result); // round to nearest integer
console.println("Rounded to integer value: " + result);
result = result * 1000; // restore decimal to original location
console.println("Restored value: " + result);
George Kaiser