Hi,
I have a solution.
1st question M1 - only to select some brands - your "previous" question.
Then:
eqM1 (hidden question of type equation): build a list of characters, if the main brands were selected
{join(if(M1_SQ001=="Y","A",""),if(M1_SQ002=="Y","B",""),if(M1_SQ003=="Y","C",""))}
eqM2 (hidden question of type equation): build a list of characters if the other brands were selected
{list(if(M1_SQ004=="Y","D",""),if(M1_SQ005=="Y","E",""),if(M1_SQ006=="Y","F",""),if(M1_SQ007=="Y","G",""),if(M1_SQ008=="Y","H",""),if(M1_SQ009=="Y","I",""),if(M1_SQ010=="Y","J",""))}
eqM3 (hidden question of type "short text" with default value "eqM2"):
Included this javascript to select three brands randomly selected out of eqM2
Code:
<script type="text/javascript" charset="utf-8">
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
$(document).on('ready pjax:scriptcomplete',function(){
// Fill the array
var arr = $('#question{QID} input[type="text"]').val();
var nArr = arr.split(', ');
arr = shuffle(nArr);
anumbers = arr.slice(0,3);
$('#question{QID} input[type="text"]').val(anumbers);
$('#question{QID}').hide();
});
</script>
QInfo (question of type "text display")
Because we hide eqM3 by javascript we need some visible question in this group.
Use it to explain to the respondent what happens next
eqM4 (hidden question of type equation): build a three letter string with leading eqM1 and trailing eqM3
{substr(join('#',eqM1,str_replace(',','',eqM3)),0,4)}
The first "#" is to avoid an idex of "0". the function "strpos" uses "0" as "not found".
And the function "str_replace", removes the comma.
M2: The resulting multiple question.
With subquestion relevance
My Brand: strpos(eqM4,"A")>0
Comp 1: strpos(eqM4,"B")>0
...
If I misunderstood your requirements, use it as an example.
Joffm