Select to view content in your preferred language

How can I condition a question through the Xlsx, I am trying to condition the answer to YES or NO.

731
4
08-25-2022 09:23 AM
AnaMariaG
Emerging Contributor

Hi Community, 

I am doing a survey using Survey123 app and aggregating the data through Xlsx. I have the following situation and have not been able to solve it:

I have several questions that should only pop up other questions if the user answers YES and if they answer NO they should skip them and go to the next one.

I am trying to use the following function but it is not clear to me how to use it:

if(selected(${question_one}, 'yes') and selected(${question_two}, 'yes'), 'yes', 'no')

Has anyone tried something similar that can give me a hint on how to do it.

Thanks, sincerely confused.

Translated with www.DeepL.com/Translator (free version)

0 Kudos
4 Replies
DougBrowning
MVP Esteemed Contributor

Is this for the relevant column?  You did not say.   If so it just needs to eval to true so just this works.

selected(${question_one}, 'yes') and selected(${question_two}, 'yes')

0 Kudos
AnaMariaG
Emerging Contributor

Correct Doug and I'm sorry I did not say it. It is to be used in the relevant Column, 

By now I'm trying this:  

AnaMariaG_0-1661446796295.png

 

But it says the following "There has been a problem trying to replace --- with the Xpath... There is no survey element with this name 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Not sure where you got that syntax, that is not even 123 code.  What I posted should work.

0 Kudos
Katie_Clark
MVP Regular Contributor

If you're just trying to conditionally hide fields, you would put the expression in either the relevant or the body::esri:visible column. I recommend reading this blog post for more info on the nuances between the two columns. 🙂

The syntax would be something like:

${question1} = "Yes"

or

${question1} = "Yes" and ${question2} = "Yes"

With the expression you have in your original question, that syntax would be used in the Calculate column and would return the value "Yes" or "No" into that question based on answers from previous questions.

Hope that helps!

 

 

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos