Failure to put a constraint based on two previous question choices

1. What is the issue? Please be detailed.
My constraint is not working properly. Example:
Q1 Is mother alive (yes or no)
Q2 Is father alive (yes or no)
Q3 Who attended with participant at this visit? (Father, mother, grandfather etc)
If Q1 mother is dead Q3 mother should not be selected, or Q2 father is alive -Q3 option father should not be selected
2. What steps can we take to reproduce this issue?**
I used the following syntax:
(${Q1}! ='Yes' and Q3! ='Mother') or (${Q2}! ='Yes' and Q3! ='Father')

3. What have you tried to fix the issue?

4. Upload any test forms or screenshots below.

Hi, can you please share the XLSForm here? It will help with troubleshooting.

1 Like

Thank you

here is the xlsForm. Was having difficulties uploading.
VM01 test.xlsx (14.0 KB)


Try the following constraint:

if(${B02_malive}!='1',.!='1','true') and if(${B03_falive}!='1',.!='2','true')

if the mother is not alive, then the mother cannot be the caregiver, else okay
if the father is not alive, then the father cannot be the caregiver, else okay

your current constraint

(${B02_malive}!='1' and .!='1') or (${B03_falive}!='1' and .!='2')

reads like
must be true that if mother is not alive then mother cannot be caregiver
must be true that if father is not alive then father cannot be caregiver

Thank you Dan, your code worked perfectly for me.