Skip to main content
jant45441726
Participant
October 18, 2016
Question

How do I calculate this?

  • October 18, 2016
  • 3 replies
  • 445 views

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

This topic has been closed for replies.

3 replies

Inspiring
October 18, 2016

Your question is not clear.

Please restate yuor question.

jant45441726
Participant
October 20, 2016

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 -

Could you please help me.

Inspiring
October 20, 2016

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;

}