Select to view content in your preferred language

Conditional Visibility - show question if a particular choice is selected in one or more other questions

355
12
Jump to solution
a month ago
LouiseHarris1
Regular Contributor

Hello

I have created a form and I need to set up conditional visibility that will show a question if 'arable' is selected in one or more previous questions.

Question - Farm Type

Question - Main Enterprise

Question - Other Enterprises

If 'Arable' is chosen for any of the above questions I want to show the question 'Crops Gown?' 

What expression do I need to use please?

Thanks

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

Ah yes, apologies I read through too quickly.  Are you able to screenshot to include the relevant column and contents and copy past the exact cell content/expression into the thread?

It really seems like missing parentheses, syntax or spelling error - e.g.  I can also see farm_type instead of Farm_type  in the expression you shared previously (but am unsure if it is case sensitive).

View solution in original post

0 Kudos
12 Replies
DavidPike
MVP Frequent Contributor

It's all done using the 'relevant' column in Connect. 

Here's a good example of showing an 'issue comments' question with visibility dependent on either of 2 questions.

 https://community.esri.com/t5/arcgis-survey123-questions/survey123-relevant-field-based-on-value-fro...

If your questions have multiple answers e.g. arable and pasture - then use the 'selected()' syntax
https://community.esri.com/t5/arcgis-survey123-questions/quot-relevant-quot-field-syntax-for-multipl...

 

 

0 Kudos
abureaux
MVP Frequent Contributor

You can use their the relevant or the body::esri:visible column. They have the same visual effect, but their back-end process is different.

Relevant will hide something, and in doing so make it null. Aka, if it's hidden, it doesn't exist.

body::esri:visible will just hide something (end of storey). Aka, if it's hidden, it still exists.

In either case, I highly recommend you use selected(${my_question},'Hello World'). Yes, you can use ${my_question}='Hello World', but that doesn't always work (e.g., for select_multiple), whereas the selected() approach is much more reliable.

Here is an example:

abureaux_0-1736196161418.png

 

LouiseHarris1
Regular Contributor

Hi. Thanks for your response. So I am aware of using the selected expression and have used this in other questions on my form, but, want I am trying to do is to reference multiple questions in the selected expression e.g if 'arable' is selected in Farm_type, or or if 'arable' is selected in Main_farm_enterprise or if 'arable' is selected in Other_enterprises then show the question'what crops are grown?' (see screenshot below) Is that possible? I have tried various expressions like the following but always get errors

selected(${farm_type}, 'Arable') or selected(${Main_farm-enterprise}, 'Arable') or selected(${Other_enterprises}, 'Arable')

selected(${Farm_type}, 'Arable'or ${Main_farm_enterprise}, 'Arable' or ${Other_enterprises}, 'Arable')

LouiseHarris1_0-1736247408393.png

LouiseHarris1_1-1736248080695.png

Thanks

0 Kudos
DavidPike
MVP Frequent Contributor

The error seems to reference crops_grown which doesn't seem to be related to this question.  I'd look for that expression and fix or remove it from xls.  

The first xepression should work, aside from a dash instead of underscore typo in main_farm_enterprise.

selected(${farm_type}, 'Arable') or selected(${Main_farm_enterprise}, 'Arable') or selected(${Other_enterprises}, 'Arable')

0 Kudos
LouiseHarris1
Regular Contributor

Crops grown is the question I am writing the expression for - I only want this question to display if they select arable to any of the other 3 questions.

0 Kudos
DavidPike
MVP Frequent Contributor

Ah yes, apologies I read through too quickly.  Are you able to screenshot to include the relevant column and contents and copy past the exact cell content/expression into the thread?

It really seems like missing parentheses, syntax or spelling error - e.g.  I can also see farm_type instead of Farm_type  in the expression you shared previously (but am unsure if it is case sensitive).

0 Kudos
LouiseHarris1
Regular Contributor

Something about the expression is wrong, I just don't know what. I've changed case to match the name field and tried writing the expression in different ways but nothing is working. 

LouiseHarris1_0-1736255035035.png

 

0 Kudos
DavidPike
MVP Frequent Contributor

You are putting the expression in the column called 'relevant' right?

0 Kudos
LouiseHarris1
Regular Contributor

I've got it working, like you said I was missing parentheses. Correct expression below.

(selected(${Farm_type},'Arable') or selected(${Main_farm_enterprise},'Arable') or selected(${Other_enterprises},'Arable'))

This post helped: Relevant Expression - multiple parameters - Esri Community

 

Thanks for your help David, it's much appreciated

0 Kudos