Count-selected in group not having desired effect

Team,
Im having a challenge using count-selected on a field list of items with yes/no answers.
I have a set of 7 questions but need most important 3 answers, tried to use count-selected(.)<=3
in a group but no effect, any help?

Hi @Oyier

count-selected() function works for one select_multiple question not for a group of different questions. If you know which questions you want to be answered you can make them required otherwise if they are random but always three you can use constraint.

There's also now rank support in ODK Collect?

As Grzegorz said, the count-selected() function doesnt operate on a group level. So you'll need to 'count' your group's questions explicitly. If - by 'selected' - you mean answer='yes', then something like this should do the trick:

calculate="(${question1}='yes') + (${question2}='yes') + (${question3}='yes') + ..."

Which will give you the total number of questions to which you answered 'yes'. [this works by virtue of fact XPath will cast the boolean subexpressions to 0 or 1 accordingly, which you then sum numerically]