AnsweredAssumed Answered

"If" calculations for select_multiple questions

Question asked by adailey_slo on Aug 27, 2019
Latest reply on Aug 29, 2019 by dougbrowning


I am creating a survey using Survey123 Connect.  My current problem is that I'm trying to do "if" statements in the "calculation" field for a select_multiple question, and it is not working (it seems to break the functionality of various repeats and relevances in the survey, even ones that do not seem connected in any way to the calculation I'm talking about).


My main questions are:

1)  Is it even possible/supported to do "if" statements within select_multiple questions, for the purpose of automatically selecting one or more of the choices based on user's answer to a previous question?

2)  How do you write a calculation that includes 2 separate/independent "if"/conditional statements? 


Here is my draft of the "if" statement:

if(${minor_count} > 0, ‘MinorsPresent’,‘’) and if(${youth_count} > 0, ‘Youth18to24’, ‘’)



Earlier in the survey, the user can enter various people's dates of birth, within a repeat; these are people who are present at a homeless camp.  I have a calculation in the survey to convert the people's ages into decimal-date-time (by subtracting their DOB decimal date from the decimal date of now().), and then I calculate the number of minors (minor_count) and the number of youth ages 18-24 (youth_count).  If there are any minors and/or youth--that is, if minor_count or youth_count is greater than zero--then I want to select choices within the select_multiple question.  This select_multiple question includes choices for minors being present and youth being present.  If there are any minors, I want to select 'MinorsPresent.'  And if there are any youth, I want to select that youth are present.


Thank you in advance for any help!