cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
adam
Level IV

Pass and Fail Condition

 

 

Hi Guys,

 

I have the following table and would like to know how shall I set the formula(or JSL) where in this case, based on ID and MAIN_RAD, I would like to check on the value of SUB_1 to SUB_3. The condition is if at least 2 of the SUB has a value of more than 20 then it will be considered as FAIL otherwise PASS.

 

For instance as you will notice, for M101X at MAIN_RAD 1, the SUB_3 is more than 20 but consider PASS as it did not fulfill the condition of at least 2 SUB more than 20 in spec limit.

 

Thank you.

 

IDMAIN_RADSUB_1SUB_2SUB_3RESULT
M101X1101529PASS
M101X215516PASS
M102W1251830FAIL
M102W281411PASS
M110A1321215PASS
M110A2514530FAIL
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Pass and Fail Condition

Here is a formula that will do what you want

If( Sum( SUB_1 > 20, SUB_2 > 20, SUB_3 > 20 ) >= 2,
	"Fail",
	"Pass"
)

The Sum() function is documented in the Scripting Index

     Help==>Scripting Index==>Functions==>Sum

The handling of Boolean logic is covered in the Scripting Guide

     Help==>Books==>Scripting Guide

If you are going to to be using JSl, you need to take the time to read the Scripting Guide!

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Pass and Fail Condition

Here is a formula that will do what you want

If( Sum( SUB_1 > 20, SUB_2 > 20, SUB_3 > 20 ) >= 2,
	"Fail",
	"Pass"
)

The Sum() function is documented in the Scripting Index

     Help==>Scripting Index==>Functions==>Sum

The handling of Boolean logic is covered in the Scripting Guide

     Help==>Books==>Scripting Guide

If you are going to to be using JSl, you need to take the time to read the Scripting Guide!

Jim
adam
Level IV

Re: Pass and Fail Condition

Thanks Jim !