Select to view content in your preferred language

Relevant Expression - multiple parameters

1091
2
10-24-2022 03:47 AM
Skerm
by
New Contributor

Is it possible to have multiple conditions in a Survey123 relevant expression?

I'm looking to only show questions if conditions from multiple questions are met. In simplest terms:

If:

answer to Question 1 = 1 or 14 and
answer to Question 2 = 'X' or 'Y'

show the question, otherwise, don't show the question.

Such an expression would work well in SQL, with appropriately placed brackets, but various combinations/orders. The answers are all referring to Names, not labels, in the choices list.

I'm thinking something along the lines of:

selected(${Accessible},'1') or selected(${Accessible},'14') and selected(${Conditions},'X') or selected(${Conditions},'Y')

Any guidance would be greatly appreciated.

Kind regards,
Skerm

2 Replies
AlfredBaldenweck
MVP Regular Contributor

Of course!

Check out here for more guidance Formulas—ArcGIS Survey123 | Documentation.

Also: Survey123 Tricks of the Trade: hidden, relevant an... - Esri Community

Your exact formula will vary by question type.

For two choice questions:

 (selected(${example1}, '1') or selected(${example1}, '4')) and (selected(${example2},'yes') or (selected(${example2},'maybe')))

 

For two text questions:

((${example4} = '1') or (${example4} = '4')) and ((${example5}= 'yes') or (${example5}= 'maybe'))

 

Remember to put parentheses around each set of conditions or else it gets the order of operations wrong and really messes things up.

 

 

jcarlson
MVP Esteemed Contributor

I don't see why this wouldn't be as simple as adding parentheses.

(selected(${question1}, 'B') or selected(${question1},'C')) and (selected(${question2}, 'E') or selected(${question2}, 'F'))

 

ArcGISSurvey123Connect_PxOGCPOxpq.gif

- Josh Carlson
Kendall County GIS