6 Replies Latest reply on Aug 10, 2017 10:34 AM by ubelongoutside

    Calculated Form Field Values Change

    ubelongoutside Level 1

      Hi,

       

      I have a formula for calculating the %CV of a set of values.  The formula is below.  The problem is that if you enter another value in one of the "fill" cells and then change it back to the original number you end up with a different calculated value.  Also if you delete the contents of the calculated cell and then click or tab out of it the value also changes.  Any idea what can be the root cause here?

       

       

      var average = this.getField("Text10").value;

      var v = 0;

      var fieldName = "fill";

      var s = 0;

      var sd = 0;

      n = 6;

       

      for (var i = 0; i < n; i++) {

          v = this.getField(fieldName + i).value;

          s = s + Math.pow((v - average), 2);

      }

       

      sd = ((Math.sqrt(s / n)) / average);

       

       

      1. event.value = sd;
      2. event.value = util.printf("%.2f", event.value);