Select to view content in your preferred language

How to keep dynamic search() list empty until a previous selection is made?

772
14
Jump to solution
08-29-2025 12:20 PM
JoseBarrios1
Frequent Contributor

Hello Everyone,

I’m building a survey in Survey123 Connect with dynamic choice lists using the search() appearance.

Example expression: search("RCWParticipantsTable?url=https://services.arcgis.com/...../FeatureServer/0&orderByFields=ParticipantID",'matches','PropertyKey',${PropertyKey})

The expression works as expected to populate the list. However, when the survey first loads, the question displays all records from the feature layer before it gets filtered by the previous selection.

I tried using the relevant column to control this, but that approach still causes performance issues and completely hides the question (whereas I want it to remain visible).

In my case, I have six select_multiple questions that all use the same dynamic list (via the search() appearance) to choose a person from a pool of 2,220 participants. Loading the entire list six times has a significant performance impact.

Does anyone have a suggestion for keeping the dynamic choice list visible, but preventing it from showing all records until it’s filtered by another question?

Thanks in advance for any guidance!

JB

 

UPDATE Note: 

I’d like to highlight that after publishing the survey, the issue occurs in both the mobile and desktop versions of the app. However, the survey works as expected ( list is not pre-loaded) in the web application.

0 Kudos
14 Replies
DavidPike
MVP Notable Contributor

I had another simpler idea which seems to achieve a partial objective.  I think it can be tweaked into a full solution with some more testing/development:

Simply set the url "https://services.arcgis.com/...../FeatureServer/0" as a Hidden question called url.  and set it Relevant on the previous question being completed e.g. Calculation 

string-length(${previousQuestion})>0

You then have your next question Appearance

autocomplete search(${url})

of course, you'd have to modify the search parameters with the filter from the question result also, but that's the basic concept above.

 

 

0 Kudos
Neal_t_k
Frequent Contributor

@JoseBarrios1 Check out this example,  I believe the question "Country4" is the example you are expecting to see, but there are several other working examples that you can see how they interact.  Hopefully you can adapt to your feature layer.

It appears with the "matches" syntax I was making it too complicated.

0 Kudos
JoseBarrios1
Frequent Contributor

Hello Neal,

Your approach works great on Connect, the mobile app, and the desktop app. However, it fails to load the list on the web app (see attached image). Unfortunately, the app is primarily intended for use on the web.

Strangely enough, my current workflow behaves the exact opposite: it loads the full list on Connect, mobile, and desktop, but works as expected on the web app.

Thanks everyone for the helpful suggestions so far — I appreciate the support in resolving this issue!

JoseBarrios1_0-1757343436556.png

 

0 Kudos
Neal_t_k
Frequent Contributor

@JoseBarrios1  I forgot,  there is some different syntax for web vs field app unfortunately and I don't know why.

web: concat("COUNTRY?url=https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Countries/FeatureServer/0?orderByFields=FID DESC")

field app/connect: concat("COUNTRY?url=https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Countries/FeatureServer/0/&orderByFields=FID DESC")

It really makes it difficult because to use this you have to chose 1 type of form.

JoseBarrios1
Frequent Contributor

Hi Neal,

Thank you so much for your help with this. It’s been challenging because the query, (using ?), doesn’t even work in Connect, although it works fine on the web. It’s difficult to tell if the query isn’t functioning properly until the survey is published. Since my survey is primarily intended for web use, I’ll go ahead and implement the workflow you suggested as a solution.

Thanks again for your time and support!

JB

0 Kudos