web app: "failed to load the choice list" generated by search()

1528
3
Jump to solution
07-26-2023 12:53 PM
mikAMD
by
Frequent Contributor

In my XLSForm, I have this choice list that is generated from a search() function, which querys a table in the AGOL feature service. I set it up based on the doc and this blog post.

The list loads fine when working in Survey123 Connect and on the android app. However, that is not the case in the survey123 web app where I get a "Failed to load the choice list. Please contact the survey owner to fix it." error. There is an empty box with an arrow but clicking on it brings nothing (except the field name as a popup).

Survey123 Connect (peoples names so hidden):

mikAMD_0-1690400407132.png

Web app:

mikAMD_1-1690400454901.png

In my XLSForm, under the choices tab, I have:

list_namenamelabel
ins_pnprenom_nomprenom_nom

 

and in my survey tab (the field name in question is binded to null because I then get the ID of the user (inspecteur_man_id) and that's what I want to store):

typenamelabelappearancerequiredcalculationbind::esri:fieldType
select_one ins_pnprenom_nominspecteurminimal search("prenom_nom?url=feature_service_url/FeatureServer/10/query?where=1=1&orderByFields=inspecteur_man_id asc")yes null
integerinspecteur_man_idinspecteur_man_idhidden pulldata("@layer", "getValue", "attributes.inspecteur_man_id", "feature_service_url/FeatureServer/10", concat("prenom_nom ='", ${prenom_nom}, "'"))esriFieldTypeInteger

 

Am I doing something wrong? From what I understand, search() is supposed to work in the web app.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
mikAMD
by
Frequent Contributor

All right!

 
So I again found the problem! It seems it was not related at all with the "minimal" or "autocomplete" appearance.
 
As stated here, I added query parameters to the url i put in the search() function:
 
Tip: You can optionally append query request parameters to the REST endpoint of your feature layer or map service layers to configure the search behaviour. This can be really useful for incorporating buffers of query geometry using &distance= and &units=, as well as limiting the number of query results using &resultRecordCount=. These URL parameters can also be set by the user in the form itself, see the Point intersects buffered points (with attribute filter) example below for details.
 
So I had put in the "appearance" field this: 
      autocomplete search("entree_inspecteur_man?url=feature_service_url/FeatureServer/14/query?where=1=1&returnDistinctValues=true&outFields=entree_inspecteur_man")
 
This was causing the "failed to load choice list" in the web app, although it was working in Survey123 Connect and the Android app.
 
While troubleshooting, I finally removed everything from query, so the "appearance" now looks like this: 
      autocomplete search("nom_unique?url=feature_service_url/FeatureServer/14")
 
Works like a charm!
 
Thanks!

View solution in original post

3 Replies
mikAMD
by
Frequent Contributor

So it seems the problem is with the "minimal" appearance. Changed it to "autocomplete" and everything works fine. Although "minimal" should be supported as stated in the doc!

0 Kudos
mikAMD
by
Frequent Contributor

Apparently I was a little bit hasty.

Everything was working fine, I changed the appearance to "minimal" just to check something in Survey123 Connect. Then changed it back to "autocomplete", and doesn't work once again in the web app. Still getting the "Failed to load the choice list" error.

0 Kudos
mikAMD
by
Frequent Contributor

All right!

 
So I again found the problem! It seems it was not related at all with the "minimal" or "autocomplete" appearance.
 
As stated here, I added query parameters to the url i put in the search() function:
 
Tip: You can optionally append query request parameters to the REST endpoint of your feature layer or map service layers to configure the search behaviour. This can be really useful for incorporating buffers of query geometry using &distance= and &units=, as well as limiting the number of query results using &resultRecordCount=. These URL parameters can also be set by the user in the form itself, see the Point intersects buffered points (with attribute filter) example below for details.
 
So I had put in the "appearance" field this: 
      autocomplete search("entree_inspecteur_man?url=feature_service_url/FeatureServer/14/query?where=1=1&returnDistinctValues=true&outFields=entree_inspecteur_man")
 
This was causing the "failed to load choice list" in the web app, although it was working in Survey123 Connect and the Android app.
 
While troubleshooting, I finally removed everything from query, so the "appearance" now looks like this: 
      autocomplete search("nom_unique?url=feature_service_url/FeatureServer/14")
 
Works like a charm!
 
Thanks!