3 Replies Latest reply on Jun 18, 2014 6:55 AM by jcso9480

    formula to subtract field value from fixed number


      I am new to javascript and have been unsuccessfully trying to complete what I'm sure is a very simple task.  I have a form with 12 fields containing a dollar amount.  Field "c1" has a formula that counts the number of the 12 fields that actually contain a value.  This formula works correctly.  I want Field "c2" to show the number of fields without a value.  I thought it would be simple to subtract the value of "c1" from 12 to get the value for "c2", but i cannot get it to work.  The formula below is what I currently have in the custom calculation script window.  Any assistance with writing a code that will work would be greatly appreciated!


      var a= 12;

      var b= this.getField("c1");

      var c= this.getField("c2");


      c.value= a.value - b.value;