Select to view content in your preferred language

search() and pulldata() from feature service returning empty list and attributes

640
5
Jump to solution
09-10-2024 10:17 AM
MollyMoore
Frequent Contributor

I am setting up a survey to use the search() function to query a feature service layer to auto-populate values in a drop down for users to select. I then want other fields to auto-fill attributes in the Survey123  from the feature service layer with the pulldata() calculation. When I set up these functions, the list is empty and the pulldata() function (when tried separately) is also empty. The feature layer is in a referenced feature service hosted on our enterprise portal and the Survey123 form is being built in the same same portal. What am I doing wrong?

My search() expression in the appearance option:

w2 autocomplete search("site_name_picker?url= https://<enterprise_url>/server/rest/services/PNHP/NHA_EDIT/FeatureServer/0")

 

My pulldata() expression in the calculate option:

pulldata("@layer", "getValue", "attributes.nha_join_id", "https://<enterprise_url>/server/rest/services/PNHP/NHA_EDIT/FeatureServer/0",concat("site_name='", ${site_name}, "'"))

 

I've attached photos that show the .xlsx file and the blank drop down list.survey123_1.PNGsurvey123_2.PNGsurvey123_3.PNG

0 Kudos
1 Solution

Accepted Solutions
JenniferAcunto
Esri Regular Contributor

Pulldata does not like being included with other functions (concat, if, etc). You might want to try breaking up your pulldata into separate calculations:

1st question builds the where clause.

concat("site_name= '", ${site_name}, "'")

2nd question is the pulldata calculation.

pulldata("@layer", "getRecord", "https://<enterprise_url>/server/rest/services/PNHP/NHA_EDIT/FeatureServer/0", ${where1}).

Along with what Jim mentioned, I would also check to ensure that query is enabled on the layer you are using with the search appearance.

 

 

 

- Jen

View solution in original post

0 Kudos
5 Replies
Jim-Moore
Esri Regular Contributor

Hi @MollyMoore 

The syntax in your expressions looks good. A couple of things to check:

  • Is "site_name" the exact name of the field in the feature layer with which you want to populate the choice list?
  • Does the signed in user have access to the feature layer?

Best, Jim

0 Kudos
JenniferAcunto
Esri Regular Contributor

Pulldata does not like being included with other functions (concat, if, etc). You might want to try breaking up your pulldata into separate calculations:

1st question builds the where clause.

concat("site_name= '", ${site_name}, "'")

2nd question is the pulldata calculation.

pulldata("@layer", "getRecord", "https://<enterprise_url>/server/rest/services/PNHP/NHA_EDIT/FeatureServer/0", ${where1}).

Along with what Jim mentioned, I would also check to ensure that query is enabled on the layer you are using with the search appearance.

 

 

 

- Jen
0 Kudos
MollyMoore
Frequent Contributor

Mysteriously, everything started working after rebooting two days later without changes. I updated to separate the concat() function from the pulldata() function anyway, as you suggested @JenniferAcunto, and everything seems to be functioning well. Thank you for the tip and hopefully it will make things more stable.

0 Kudos
Chris3030
Emerging Contributor

Hi @MollyMoore , does this happen in the desktop app or the web form version of the survey? I'm experiencing a similar problem right now

0 Kudos
MollyMoore
Frequent Contributor

Hi @Chris3030, I am using the desktop app and creating in Survey123 Connect. After two days, my functions mysteriously started working without changes. I did update my .xlsx to separate the functions as @JenniferAcunto suggested and things seem to be working well now.

0 Kudos