Welcome to the community, @hchoke! It seems like you are using the if-statement for ddCEREALS
, a select_one
question type, but your expression shows that you are trying to use it for a select_multiple
question type.
For your reference, selected(${ddCEREALS},'yes'
is used for a select_multiple
question type while ${ddCEREALS}='yes'
is used for a select_one
question type.
I hope this helps you solve your issue.
Thank you @Kal_Lam for your response.
What is wrong with this coding for the following question;
if(selected(${ddCEREALS},‘yes’), . >0 and .<=7, if(selected(${ddCEREALS},‘no’) . >=0 and . <=6)
Question 1; Have you taken cereals and cereal products eaten in last 24 hrs
- yes
- no
Question 2: How many days have you eaten cereals and cereal productsin the last 7 days?
If Question 1 is yes, then the response to Question 2 should be >0 and <=7
If Question 1 is no, then the response to Question 2 should be >=0 and <=6
Will appreciate your input on this.
@hchoke, well, if this is your requirement, maybe the images shared below should help you solve your issue:
In the survey tab of your XLSForm:
In the choices tab of your XLSForm:
Data entry screen as seen in Enketo: when a wrong entry is made
Data entry screen as seen in Enketo: when a correct entry is made
Data entry screen as seen in Enketo: when a wrong entry is made
Data entry screen as seen in Enketo: when a correct entry is made
Reference XLSForm:
Constraint.xlsx (12.1 KB)