3 Replies Latest reply on Oct 19, 2016 10:48 PM by George_Johnson

    How do I calculate this?

    jant45441726

      Have field (Criteria) and a fillable field (Dim) and a result field.

      Some of fillable field should be in the range of Criteria +/- 2,5%

      and other in the range of +6/-2.

      Please help

        • 1. Re: How do I calculate this?
          gkaiseril MVP & Adobe Community Professional

          Your question is not clear.

           

          Please restate yuor question.

          • 2. Re: How do I calculate this?
            jant45441726 Level 1

            I have a testsheet with some criteria and tolerances, what I can´t figure out is how to calculate that the result measured is within tolerances A (228mm +6mm -3mm)

            I have fields where the tolerances are within +/- 2,5%

            In the accepted field I have this calculated script:

            event.target.fillColor = color.transparent

            var dadiff = Math.abs(this.getField("Dim A").value - this.getField("Criteria A").value) ;

            if (dadiff <= 3) {

            event.value = "OK" ;event.target.fillColor = color.green ;

            } else {

            event.value = "Not OK" ;event.target.fillColor = color.red ;

            }

            That works when the tolerances are with in the same area in + and -

            Capture.jpg

            Could you please help me.

            • 3. Re: How do I calculate this?
              George_Johnson MVP & Adobe Community Professional

              For that first one, it seems like this should be correct:

               

              var mid = 228;

              var max = mid + 6;

              var min = mid - 3;

              var val = +getField("Dim A").value;

               

              if (val <= max && val >= min) {

                  event.value = "OK";

                  event.target.fillColor = color.green;

              } else {

                  event.value = "Not OK";

                  event.target.fillColor = color.red;

              }