Select to view content in your preferred language

body::esri::visible does not work for group inside repeat

1000
6
Jump to solution
02-27-2024 11:58 AM
sittaeco
Emerging Contributor

Hello, 

I am having difficulty with body::esri::visible for a group of questions inside a repeat. As part of a larger form, I would like users to document different types of wildlife observations. They should be able to submit several per form (using a repeat), which they are expected to submit once per day. There are several types of wildlife observations that each require different sets of questions, hence wanting to us the body::esri::visible or relevant functions. Depending on the type of observation, a specific group of questions should appear.

I am using a dynamic-grid (w6) and questions are usually appearance "w2 minimal" to keep things tiday.

You can see that "Animal observation" has been chosen for "subsistence_select_obs" but the group of questions does not appear on the survey form. The screenshot only shows one set of test questions.

I would really appreciate your feedback. Thank you! Clem

Capture.PNG

0 Kudos
1 Solution

Accepted Solutions
TylerGraham2
Frequent Contributor

I took a look at the xlsx and you were using the choice label in the selected() formula, you need to use the choice name.  I attached a corrected version of your xlsx and it show/hides as it should.  

View solution in original post

0 Kudos
6 Replies
sittaeco
Emerging Contributor

Update: I cannot seem to use body::esri::visible inside the repeat at all, including when referring to an answer inside the repeat. Relevant also doesn't work. And neither work even without grouping my questions inside the repeat. Is this normal?

0 Kudos
TylerGraham2
Frequent Contributor

It looks like your determining the relevance based on a select_one question type. The best practice is to use selected() formula for the the relevant or body::esri:visible column.  You will want to change ${subsistence_select_obs} = 'Animal observation" to selected(${subsistence_select_obs}, 'Animal observation').  Selected() checks if the choice selected in the form matches "Animal observation" and returns true/false.  

Quick note on body::esri:visible vs relevant columns is the visible column does not clear any entered values while relevant does.  For example, someone selects the "Animal Observation" choice that then reveals the Animal Observation group and enters some data in there before they realize they didn't actually have an animal observations and changed their answer to "No Animal Observation" (hypothetical choice for the exercise).  The body::esri:visible only hides the fields/group, but keeps anything that was entered in the form.  Using the Relevant column clears anything that might have been entered out of the now hidden fields.  

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-hidden-relevant-an...

0 Kudos
sittaeco
Emerging Contributor

Hi Tyler, thank you for the thoughtful response - I really appreciate it. I was persistent because I got a similar scenario to work outside of the repeat; though, now that I look at what I tested, the question was a select_multiple and not a select_one. Perhaps that made a difference?

Either way, I will try Selected() tomorrow and update the thread. Thanks again and have a good day! Clem

0 Kudos
sittaeco
Emerging Contributor

Hi Tyler, I tried to use selected() inside the relevant column for the repeat even though it's a select_one question and it still isn't working. I tried using it on a group of questions and with different names/labels without any success. Also, I added my XLS file to the original post. Do you have any other ideas as to why this does not work? Thanks!

 

Capture.PNG

0 Kudos
TylerGraham2
Frequent Contributor

I took a look at the xlsx and you were using the choice label in the selected() formula, you need to use the choice name.  I attached a corrected version of your xlsx and it show/hides as it should.  

0 Kudos
sittaeco
Emerging Contributor

Thanks Tyler! I am glad it was something simple - I won't be making that mistake again.

Have a nice day,
Clem

0 Kudos