Anyone that can help me with a script to divide two fields please help. I've tried the scripts found here but I have a hitch:
I need to multiply the 'TotalIncome' field by 12 and divide that result by the 'MonthlyPayment' field to get a percentage in the 'ratio' field.
Thanks in advance.
Use this as the custom calculation script of the ratio field:
var monthlyPayment = this.getField("MonthlyPayment").value;
var totalIncome = this.getField("TotalIncome").value;
if (Number(monthlyPayment)==0) event.value = "";
else event.value = ( totalIncome * 12 ) / monthlyPayment;
You can not divide by zero or a null value. You need to write a custom script with a program control statement to avoid this condition.