3 Replies Latest reply on Sep 18, 2015 2:18 PM by George_Johnson

    how to add field values custom calculation script




      I have a calculation script:


      var abi = this.getField("DEXM").value;

      var foc = this.getField("acrofocus").value;

      var misc = this.getField("acromisc").value;

      var lvl = this.getField("LVL").value;

      var chk = this.getField("Check Box1.0").isBoxChecked(0);






      event.value = (5 +foc+misc+abi+(Math.floor(lvl/2)));}


          {event.value = (foc + misc + abi + (Math.floor(lvl/2)));}


      I am trying to get the sum of the fields based on the value of a checkbox. The if statement seems to be working because the result changes, but instead of adding the results, it appends the numbers. Example: chk ==1, so add 5 + 0 + 0 + 2 + 1 and display 8. But instead, it displays 521 for event.value. All of the fields including event are numeric with 0 decimal places. What is going on here? I would expect this if they were text formated fields, but they aren't.


      Thanks all.