Result field is always filling minimum value even if source field is empty
Hi, I have two fields in my script. The source field is EVPI which is a user input with auto formatting applied and the resulting event field where this custom script is entered. All of the basic conditional arithmetic is working.
When the source field is empty, the result field is supposed to be empty as well and allow for user input. However, the result field is always filled with the minimum value called in the script despite other conditionals trying to create the event value as empty. I’m not sure how the event.value is stuck at the minimum value of 100 even though it updates higher for the conditional math.
var EVPI = this.getField("ESTIMATED VALUE OF PUBLIC IMPROVEMENTS").value;
if (EVPI <= 5000) {
var Fee = 0.05*EVPI;
var FM = 100;
if (Fee <= FM) {
event.value = FM;
} else if (Fee > FM) {
event.value = Fee;
} else {
event.value = "";
}
} else if (EVPI > 5000 && EVPI <= 25000) {
event.value = 250+0.04*(EVPI-5000);
} else if (EVPI > 25000 && EVPI <=100000) {
event.value = 1050+0.03*(EVPI-25000);
} else if (EVPI > 100000) {
event.value = 3300+0.02*(EVPI-100000);
} else if (EVPI === "") {
event.rc = true;
} else {
event.value = "";
}
