I need some help. I have a field I am trying to calculate a percentage from another field. I have a field called Major Program Sold which is the sum of all the programs. And i want it to calculate into a percentage but not go over 100%. I need a customer calculation script.
One needs at least 2 values to compute a percentage and Since the percentage is just a reformatting of the decimal result of the division you can compare the result of the division to 1.00
If you are computing the percentage each component of the total is, then you may need to round the computed value, which different from the formatted displayed value. This occurs because of how computers compute using binary values and JavaScript's converting numbers to IEEE floating point values. These two actions do not always convert to rational numbers and introduce a small error which can accumulate to cause larger errors.
You should also check the field calculation order if you are computing the percentages from a computed total.
var v1 = +this.getField("MAJOR PROGRAM SOLD").value;
if (v1==0) event.value = "";
else event.value = (v1 / 1.00);
I am using this calculation but it is coming out to example 10,000%. Should I use a different calculation?
What's the point of dividing a value by 1?
Also, a percentage field should have a value between 0 (0%) and 1 (100%).