Count selected options

Hello everyone,
I need help counting all selected options in a multiple select question. How do I do about it eg What are the available FP methods and commodities in stock?
1 Injectables
2 Implants
3 Pills
4 Condoms
5 Emergency Contraceptives
6 IUDs
99 Other (specify)
Thanks in advance

Use count-selected(${question_name}) to count the number of selected options.

Thanks - How about those that are not selected?

Try the suggestions below..

Thanks but I need to know the number of options not selected. The information shared seems not applicable to this case?

What about a combination of 'count(instance('list_product')/root/item[string-length(name)>0])' and 'count-selected(${question_name}' I.e the first minus the second?

@chauvoice2020 Here's an example XLSForm which shows how you can do this - it also makes use of the trick showed earlier by @Xiphware of turning a select into a nodeset by using the choice-filter attribute. Hope this helps.
test_count_not_selected.xlsx (7.4 KB)

you could try to subtract count-selected(${question_name} from the number of available multiple options

1 Like