Using Conditional IF with a Checkbox to calculate in Another Field
I'm stumped but then again new to this. I would be grateful for any thoughts:
*. VC (A check Box)
*. VendorComp (formatted as a Number)
*. TotalTaxDue (formatted as a Number)
When the box is checked, the calculation should be:
VendorComp = TotalTaxDue * 1.5/100 // 1.5% of TotalTax Due)
When unchecked:
VendorComp = 0
I've added the following Custom Calculation in VendorComp:
---------------------------------------------------------------------------------------
var f = this.getField("VC").value; // If Checked, then "Yes", If unChecked or Blank then NOT EQUAL to "Yes"
if (f="Yes") // Means the box is checked
{
this.getField("VendorComp").value=Math.round(this.getField("TaxTotalDue").value*1.5/100);
}
else (f!="Yes") // Means the box is Unchecked
{
this.getField("VendorComp").value=Math.round(this.getField("TaxTotalDue").value*0/100);
}
--------------------------------------------------------------------------
It does not work. If I remove the conditional and ONLY have the formula:
this.getField("VendorComp").value=Math.round(this.getField("TaxTotalDue").value*1.5/100)
That works. So I must assume I'm not doing the conditional IF correctly.
I have tried "Switch" as well to no success. However, I may be doing that incorrectly as well.
Any help would very much appreciated.
Thanks.
Louis
