Alternative would be:
You could always try a custom bit of code. That way you could write one line and total up the results and output as needed.
Create a file in assets/snippets/custom called if.myArray.php with the following contents:
<?php
// Subject must be in the form of input||output
// Input is what you have to check
// output is what you are matching against
function myArray($subject, $operand) {
$modx = EvolutionCMS();
$i = 0;
$data = explode("||", $subject);
// data[0] is input
// data[1] is output
$output = explode(",", $data[1]);
foreach ( $output as $check )
{
if ( in_array($check, explode(",", $data[0])) )
{
$i++;
}
}
$modx->setPlaceholder("myArrayResult", $i);
return $i;
}
Make your snippet call:
[[if? &is=`[*my-codes*]||A,B,C,D,E,F,G,H:myArray` &custom=`myArray` &then=`[+myArrayResult+]`]]Â
You are passing the TV into the program and checking to see if any of the TVs match against the second list.
If you TV was A,F,G then it would check each A,B,C,D,E,F,G,H and say that 3 match.