Answered
Complex Calculation Treating Negative Numbers as Zero in PDF Form

I need a javascript for Complex Calculation where Total + SAI + Pell = Need; but if SAI is a negative number, treat as zero. Can anyone please assist me?

I need a javascript for Complex Calculation where Total + SAI + Pell = Need; but if SAI is a negative number, treat as zero. Can anyone please assist me?
Use this in "Need" field as custom calculation script:
var total = Number(this.getField("Total").valueAsString);
var sai = Number(this.getField("SAI").valueAsString);
var pell = Number(this.getField("Pell").valueAsString);
event.value = total + Math.max(0, sai) + pell;
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.