Choice filter on select multiple

i have been trying to create filter on a select multiple field and all i get is a blank page. please can someone help me with an example which contains select filter and a relevant field.

We'd love to help, but your post does not contain enough information. In general, the best way to get help is to fill out the questions in the pre-filled template that you get when you create a support post. So, with that in mind, can you answer these questions?

  1. What ODK tool and version are you using? And on what device and operating system version?
  2. What steps can we take to reproduce the problem?
  3. What you have you tried to fix the problem?
  4. Anything else we should know or have? If you have a test form or screenshots or logs, please attach.
  1. semester
    answer semester 1, semester 2

  2. if semester 1 it should display theses courses
    101,103,105,107,109 you should only be allowed to select three out of the list

  3. if semester 2 it should display these courses
    102,104,106,108,110 it should only be allowed to select three out of the list

If you're using XLSForm to create your survey...

It sounds like you want to implement a cascading select.

To limit the number of selections, you should be able to use a constraint of count-selected(.)<=3 as noted in: How to impose strict upper limit on the number of selected answers to 3 for multiple choice questions?

Your survey worksheet should look something like:

+-------------------------+--------------------+----------------------+--------------------------------+----------------------+------------------------+----------+
|          type           |        name        |        label         |         choice_filter          |      constraint      |   constraint_message   | required |
+-------------------------+--------------------+----------------------+--------------------------------+----------------------+------------------------+----------+
| select_one semesters    | semester-selection | Select the semester. |                                |                      |                        | yes      |
| select_multiple courses | course-selection   | Select the courses.  | semester=${semester-selection} | count-selected(.)<=3 | Must select 3 or less. | yes      |
+-------------------------+--------------------+----------------------+--------------------------------+----------------------+------------------------+----------+

and your choices worksheet should look something like:

+-----------+------+------------+----------+
| list name | name |   label    | semester |
+-----------+------+------------+----------+
| semesters |    1 | semester 1 |          |
| semesters |    2 | semester 2 |          |
|           |      |            |          |
| courses   |  101 | course 101 |        1 |
| courses   |  103 | course 103 |        1 |
| courses   |  105 | course 105 |        1 |
| courses   |  107 | course 107 |        1 |
| courses   |  109 | course 109 |        1 |
| courses   |  102 | course 102 |        2 |
| courses   |  104 | course 104 |        2 |
| courses   |  106 | course 106 |        2 |
| courses   |  108 | course 108 |        2 |
| courses   |  110 | course 110 |        2 |
+-----------+------+------------+----------+

(note: I didn't test this. If this doesn't answer your question please post the survey form that you've tried already and that is not working.)

2 Likes

it is still giving me empty options. is it possible that my device
does not support select multiple

Are you using multiple languages in the survey?

Can you upload the file that isn't working?

What version of ODK Collect are you using and what device?

I have the same situation but in mine xlsform the first question type also select_multiple.... it gives empty page also in the next question is there any idea for that

Are you able to post your XLSForm here?

1 Like

Problem just now sorted out many thanks......

What was the issue? And how did you solve it? Maybe your explanation can help someone else.

1 Like

Here: Choice filter with multiple selection
@Moteb_Marei created a new topic and there is a solution.