Relevant logic not working in Survey123. Trying to hide survey fields unless something else has been selected.

1183
3
07-13-2021 01:44 PM
BenWan
by
New Contributor III

Hi, I have a survey built through S123 connect with xls form. Users evaluate a site and if there are issues, they mark one of the "select_one" options that are given to them. They can also select "No issues", which has a value of "1".

I also have a comment field and a photo upload field that ONLY appears when users have selected an issue, this is done through using language under "relevant" for the comment and photo upload fields.

For some reason the code below does not work, though in my mind, seems perfectly logical. Is there something I am missing? When I pull in the feature layer to ArcGIS Pro the defaulted value is <Null> for my issue choices, perhaps that may cause some issues?

Here is the code below that I have under "relevant" for my comment field and photo upload field:

not (selected(${af_cleanliness_issues}, "1") or ${af_cleanliness_issues} ='')

 

Tags (1)
0 Kudos
3 Replies
Jim-Moore
Esri Regular Contributor

Hi @BenWan 

The only thing I can see that could be causing an issue is the space after 'not'. Could you try removing the space and see if this solves the issue? i.e.

not(selected(${af_cleanliness_issues}, "1") or ${af_cleanliness_issues} ='')

Best, Jim

LeonardBarnhill
Occasional Contributor

Am I correct in reading the logic to say Not if == 1 or if Null?  This implies any other answer would trigger the actions.  You could try ${af_cleanliness_issues} != '1' alone.  If that works then add the or ${af_cleanliness_issues} ='' with parens as above.  Single Quotes around 1 might be tried also.

0 Kudos
BenWan
by
New Contributor III

Hi all, we were able to figure it out.

What happened was that we had a data layer that we were applying this survey to, and we appended data over and when this happened, it wiped out any defaults or nulls or empty strings. Instead of stating whether or not something was a Null, we instead used count logic and so if the count was 0, the comment and photo group wouldn't show, and also if the selected value was "No issues" then it would also not show.

Thanks for the suggestions!

0 Kudos