Confirmit array If statement

Quick code to check a selection of variables for a code of 2 which is a fail.

Checks all of the top variables  [‘qnr_main_section1_PF’……..etc.

If any of these are marked as code 2 and if so set var qnT = f(‘qnr_overall_QA_PF’); as 2 which is overall fail

Else set to 1 which is pass

var qIDsToCheck = [‘qnr_main_section1_PF’,’qnr_main_section2_PF’,’qnr_main_section3_PF’,’qnr_main_section4_PF’,’qnr_main_section5_PF’];
var qnT = f(‘qnr_overall_QA_PF’);
for(var i = 0; i < qIDsToCheck.length; i++)
{
var qnFrom = f(qIDsToCheck[i]);
if(qnFrom.any(‘2’))
{
qnT.set(qnFrom.get());
break;
}
else
qnT.set(‘1’)
}

 

Checks all of the top variables  [‘qnr_main_section1_PF’,’qnr_main_section2_PF’,’qnr_main_section3_PF’,’qnr_main_section4_PF’,’qnr_main_section5_PF’];

If any of these are marked as code 2 and if so set var qnT = f(‘qnr_overall_QA_PF’); as 2 which is overall fail

Else set to 1 which is pass