Don't allow other options to be selected with Don't Know

What is the problem? Please be detailed.
Hello ODK

Question:
At what time do you watch television the most?

Options:
7-8 am.......1
8-9 am.......2
9-10 am......3
10-11 am.....4
..
..
..
5-6 pm.........10
don't know.....11

If the respondent say don,t know then other rest of the option should not be recorded.

What ODK tool and version are you using? And on what device and operating system version?

What steps can we take to reproduce the problem?

What you have you tried to fix the problem?

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi,

use constraint not((selected(., '1') or selected(., '2') or selected(., '3') or selected(., '4')) and (selected(., '11'))

Thanks,
Imran

Hi Imran

Can you please elaborate it, I didn't understand the logic.

If "don't know" is selected then other option should not be selected.

Sanish

The constraint not(selected(., 'dont_know')) or count-selected(.) = 1 should work for you. This says that either "don't know" isn't selected or if it is only one item can be selected.

You can try this out with the form here.

1 Like

Hi Martin,

What is the meaning of dot(.)

Hello @sanish_shrestha,
dot here refers for the current question .

Thanks and Regards,
SGSC

2 Likes

Hello ODk

I wrote this logic but it show error

not((selected(., ‘1’) or selected(., ‘2’) or selected(., ‘3’) or selected(., ‘4’) or (selected(., ‘5’) or (selected(., ‘96’)) and (selected(., ‘98’))

Hi,

Please follow the example of @LN.

Thanks

Hi
I have given not selected name is "98"
and I wrote this code in constraint
not(selected(., ‘98’)) or count-selected(.) = 1

and its shows this error
Error: Problem with JavaRosa Parsing Form: org.opendatakit.aggregate.exception.ODKIncompleteSubmissionData: Javarosa failed to construct a FormDef. Is this an XForm definition?

Thank-you Friends ,

It worked.

2 Likes

A post was split to a new topic: "unbalanced brackets" error message