LaserGecko Posted June 12, 2008 Share Posted June 12, 2008 Just wondering... Is there a more elegant way than using an IF statement with multiple "AND" conditions to test multiple fields, then display the result? We're making a database for each of the boards we produce. Each board has different tests that must all be "Pass" or the board will "Fail". My PassFail Display field is setup thusly... Case ( Condition1 = "Pass" and Condition2 = "Pass" and Condition3 = "Pass"; "Pass" ; "Fail" ) (Actually, that code clip is from a different field, but it's the same syntax as "IF" right now.) Some of these boards have fifty test points. Granted, it's pretty easy to just copy "= "Pass" and" to the clipboard and paste them into the calc field after double clicking the field name, but is there a better way to do it? We're using FMPro 9 Advanced, btw. Thanks much! Link to comment Share on other sites More sharing options...
Maarten Witberg Posted June 12, 2008 Share Posted June 12, 2008 offhand I'd say create a separate conditions table and a test table as join table between board and conditions . but for more advice you'd have to tell more, I'm supposing that some conditions will be used for all boards and some for specific boards. I'm also supposing we're talking about electronics components and quality control of some kind? oh and use boolean values instead of text values under the hood. If you have say fifty conditions, then sum ( ConditionsJoin::testresult ) = 50 is the pass test. or better still, sum (ConditionsJoin::testresult) = count (conditionsJoin::JoinID) Link to comment Share on other sites More sharing options...
Molson Posted June 12, 2008 Share Posted June 12, 2008 Is there a more elegant way than using an IF statement with multiple "AND" conditions to test multiple fields, then display the result? Hi LaserGecko, If your condition fields were number fields, where 0 = pass and 1 = fail, then you could just sum the fields. If the sum is > 0, one or more conditions failed. Michele Link to comment Share on other sites More sharing options...
Techphan Posted June 12, 2008 Share Posted June 12, 2008 Pass=1 Fail=0 Calc Field =T(1)*T(2)*... *T(N-1)*T(N) A hassle to setup the first time but if any test is 0 the result is 0. Link to comment Share on other sites More sharing options...
Recommended Posts