The note should appear depending on the selection in the multi-selection question

Hello community, i have an issue.
There is select_multiple question (Question1) which has several options, and one of them - “person’s age 65+”. After this question, there is roster (Question2), which is asking for gender and age.
I want that warning note must appear with the warning, in case of selecting in Question1 an option “person’s age 65+”, but there will be no persons in Question2 with the age 65+.
So i already have done the counter which counts people 65+ in Question2. And it works good. So my note appear when option “person’s age 65+” selected, and only it. But if there are “person’s age 65+” option, and any another option (a.e. “Pregnant”, or “Disabilities”), my warning note doesn’t appears.

My two variants of formula for “note” in “Skip logic” is:

  1. “((${_Status}=‘_65+’ and count-selected(_Status) >= 1) or (${_Status}=‘_65+’ )) and ${_65plus_amount}=0”
  2. “((${_Status}=‘_65+’ and count-selected(_Status) >= 1) and ${_65plus_amount}=0) or (${_Status}=‘_65+’ and ${_65plus_amount}=0)”
    Where: _Status = select_multiple question =Question1;
    _65plus_amount = result of calculator which counts people 65+;
    But unfortunatelly nothing works.

Could you help me with proper formula? I have attached to googledrive this XLSForm kobo_sample.xlsx - Google Sheets

The better option will be constraint of course, so called “hard constraints” - “Notes can also be used for “hard” constraints that should be permanently displayed until they are resolved by using the technique above and setting required to true()” (Form Logic - ODK Docs). But I’ve given up.

@Andrii1 ,

In your XLSForm, “_Status” is a multiple-choice question type. If you want to reference data from multiple selections, you need to use selected(${_Status}, '_65+') instead of ${_Status} = '_65+'.

As I understand it, if a respondent selects “Family member over 65” in question 1—whether with other options or not—but no family members aged 65 or above are listed in the roster age question, you want to display a note question.

If that’s the case, use the following XLSForm skip pattern for the note question:
selected(${_Status}, '_65+') and ${_65plus_amount} = 0.

I have also attached the file for your reference.
kobo_sample_V02.xlsx (7.4 KB)

2 Likes