At question FR13 you only want to show the brands answered at question FR8, but max 6 of those, and we should give priority to the first 12 answers. If we have more than 6 to choose from, we do a "least fil"l selection of both the priority brands and also the other brands if we are to select some from those as well.
At question FR8 we have 21 brands in total to choose from.
So if the respondent knows more than 6 of the first 12 brands we select by "least fill" from those, for a maximum of 6. If we have fewer than 6 of the priority brands but have some of the non-priority brands selected, we pick the remaining brands from those, and again if more than we need, we pick by "least fill".
An additional requirement is that the respondent needs to select more than 2 brands in order for the selection to be done.
In the helpdesk projects there is a general example how to do this:
This solution is to explain the example above.
FR8 is a multi response question with the 21 brands.
FR8(b) autopunches any answer between 1 to 12 from FR8(a)
FR8(c) autopunches any answer between 13 to 21 from FR8(a)
In the next Goto we add a condition when FR8 has 2 or less answers and just skip to the next section.
Dummyquestion maxToPick is used to set the max number of brands to pick.
In our example we just want to pick max 6 brands.
We save the API token in this question.
If you don't know your API token just contact email@example.com to request your API token.
In the dummy question priorityCount we save the count of the answers from FR8(b)
In the dummy question toPickFromRest we calculate how many to pick from the non-priority.
In BrandsSelected we capture the brands for the priority and non priority pick, by using the "least fill" script.
And the final selection is in subquestion .c
In the next section we have an information box to add another filter to exit the survey if FR8 has more than 2 answers.
And now in FR13 we show only the answer from BrandSelected (c).
In the example below you also see 22 in the answer control (this is answer option "None") which always needed to be shown as well.