Relevant syntax for Select_Multiple questions in Survey123 to generate a follow up question for only the selected answers

331
6
Jump to solution
03-03-2021 05:50 AM
Adam_Coburn_NCC
New Contributor II

Hello,

I am creating a Survey123 form in Connect where one of the questions asks for the reason why they are wanting to enroll in this tree planting scheme. The question is a Select_Multiple with 12 possible choices. I would like a free text box to appear when 11 out of these 12 possible answers are selected. 

I have read the following similar questions asked on GeoNet but the only solution I can find that works is one I have used on a previous form but is not ideal in this scenario:

Select_Multiple Relevant in Survey123: Follow up questions for only answers selected - https://community.esri.com/t5/arcgis-survey123-questions/select-multiple-relevant-in-survey123-follo... 

"Relevant" field syntax for multiple choice questions - https://community.esri.com/t5/arcgis-survey123-questions/quot-relevant-quot-field-syntax-for-multipl... 

The art of hiding - https://community.esri.com/t5/arcgis-survey123-blog/the-art-of-hiding/ba-p/898454 

How Do I Apply A Rule In The Relevant Column When Using Select_Multiple? - https://community.esri.com/t5/arcgis-survey123-questions/how-do-i-apply-a-rule-in-the-relevant-colum... 

In the Relevant column I am using the selected() function to generate a text box if any of the 11 options are generated (screenshot attached). The issue arises when more than one of those particular answers are selected a text box is generated for each selection (understandably so). Ideally, I would like just one text box to show for the submitter to enter any relevant info irrespective of how many options are selected in the original question. 

I have tried to create this in one expression listing the names of each option with 'and', 'or' etc with no luck. I have also tried using a contains() function to no avail too.

Any ideas are greatly welcomed.  (Connect Version used is 3.9.120)

Thanks in advance,

Adam

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Frequent Contributor

I am not sure I totally get it but I think you mean just one box shows if they select any of the choices but one special one?

If so I would use not(selected(question, value)) in a relevant of a single text field.

Hope that it is

View solution in original post

6 Replies
AllisonHollier
New Contributor II

I think maybe  you need to use regex?  regex(${purpose_of_planting},'detail11')

See attached, it worked for me.   And if it works, I'd love to take credit for it, but a wonderful ESRI rep named Breanna showed it to me when I was having the same problem.  (If other, then what?)

 

Adam_Coburn_NCC
New Contributor II

Hi Allison,

Thank you for taking the time to look at this.

I've never used regex before so had a read up on it. I'm looking for a text box to appear if they select any of the options from 1 to 11 but not if the last option is selected. I couldn't see how I could get regex to solve this for me but that's probably more due to my ability level than the functions scope!!

In looking into the regex I did see how it could solve another issue I was facing (ensuring an answer was formatted a specific way as this was then used to generate an individual reference number for each form filled in (a solution which I too can not take credit for, one created and adapted from an @IsmaelChivite post on creating 'Ticket Numbers')) Using regex ensures that the information entered will always be acceptable to the following function that creates the reference number, so a huge thank you for that!

0 Kudos
AllisonHollier
New Contributor II

Yep, sorry, I misread it.  Glad regex fits in there somewhere.  I'd never dealt with it either, but it's pretty hand dandy if the application is correct.  🙂

 

0 Kudos
DougBrowning
MVP Frequent Contributor

I am not sure I totally get it but I think you mean just one box shows if they select any of the choices but one special one?

If so I would use not(selected(question, value)) in a relevant of a single text field.

Hope that it is

View solution in original post

Adam_Coburn_NCC
New Contributor II

Hi Doug,

Thank you also for your input works really well!

0 Kudos
AllisonHollier
New Contributor II

Thanks, I'm making a note of that one as well!  Great solution!

0 Kudos