Form design for multiple answers

In my xls form, I have one question, for which there are multiple answers including "Don't know".Logically data collector should not be able to select "Don't know" along with other answers.How could I maintain the situation by using "constraint".

Another inquiry thing is in the multiple answers enumerators
need to select only 3 answers among the multiple answers.Without giving hints is it possible to restrict the number of answers to that particular question.

Regards,
Bithi

Hi Bithi,

Use the constraint: not(selected(., 'answer_one') and selected (., 'dont_know')) and not(selected(., 'answer_two') and selected (., 'dont_know')). To restrict number of select, use the constraint: count-selected(.)<=3.

Thanks,
Imran

First inquiry:
something like this in constraint should work:
not(selected(.,'dontKnowOption') and (selected(.,'otherOption1') or selected(.,'otherOption2) or selected(.,'otherOption3') or selected(.,'otherOption4') or selected(.,'otherOption5')))

Thank you! I am just wondering, is it possible to create a constraint something like that not(selected(${variable name},'don't know') and count-selected(${variable name})>1) rather than write each answer.

Regards,
Bithi

1 Like

Hi,

Your question was: "In my xls form, I have one question, for which there are multiple answers including “Don’t know”.Logically data collector should not be able to select “Don’t know” along with other answers." Considering your requirement, if you write not(selected(${variable name},‘don’t know’), will not work. The logic for writing each answer is to stop the users from selecting any of those answers along with "don't know". The purpose of not(selected(${variable name},‘don’t know’) is different: This syntax can be used to make the next question appear if you do not select ‘don’t know’. And To restrict the number of select, use the constraint: count-selected(.)<=3 or count-selected(.)<4.

Thanks

Hello@IMRAN,

I have tried the 1st constraint but it was not working.
my variable name is weaver_skill and I write the constraint like that:

not(selected(., ‘A’) and selected (., ‘Y’)) and not(selected(., ‘B’) and selected (., ‘Y’)) and not(selected(., ‘C’) and selected (., ‘Y’))
where A B C indicate others option and Y refers "Don't know" option.
could you please check why it's not working.

regards,
Bithi

Hi Bithi,

Check this link: https://odk.enke.to/preview?form=http://23.21.114.69/xlsform/downloads/tmps6vbrxhr/test_form.xml and attached example form.

Thankstest_form.xlsx (12.8 KB)

2 Likes