Select to view content in your preferred language

unexpected behavior once survey published

655
6
12-14-2024 08:41 AM
LibbieWeimer
Emerging Contributor

Hi I'm publishing a survey123 form that needs to validate if someone at the address entered has already filled out the survey. I've configured the form using survey123 connect, and the survey widget acts as expected. When I publish the survey, it does not behave the same. What is going on???

My validation method:

  • addr - text field for user input of address using ArcGIS world geocoder
  • addr_text - calculation string(pulldata("@json", ${addr}, "address"))
  • dupe_check - calcluation using pulldata "getValue" from the service url for the survey -  pulldata("@layer", "getValue", "attributes.objectid", "<SERVICE URL>", concat("addr='", ${addr_text},"'")
  • condition added to addr - string-length(${dupe_check}) < 1

When I use the Survey123 Connect widget the survey correctly identifies the duplicates. When it's published, the 'dupe_check' field is always blank, even when I input a duplicate address.

0 Kudos
6 Replies
abureaux
MVP Frequent Contributor

Permissions issue? How is the layer shared, and can it be accessed in the method the field app is being utilized (e.g., users not signed in, or different users than you).

0 Kudos
LibbieWeimer
Emerging Contributor

sharing is public on the survey123 survey and on the rest endpoint in agol, and the behavior is still unexpected when I'm using my agol account, which owns everything in the survey.

0 Kudos
abureaux
MVP Frequent Contributor

Good to know!

Your FL doesn't appear to have data in it, so I ended up just making my own.

After testing, I do indeed see the same behaviour as you (i.e., working in Connect but not Field App). The layer I am using is a Hosted FL. I also tried swapping around around quotation marks (i.e., swapping between double quote and single quote), and segregating components of the formula (e.g., moving the where clause to its own calculate). Behaviour didn't change. I'd consider bringing this up with Esri support. They will be able to do a deeper dive into specific settings.

LibbieWeimer
Emerging Contributor

Thanks @abureaux for verifying the issue. I've submitted a support ticket and will update this post when I know more.

0 Kudos
BeckyC-O
Occasional Contributor

Did you ever figure this out? I'm experiencing the same problem.

0 Kudos
LibbieWeimer
Emerging Contributor

yes! the bug is still present, but you can fix your code with the following: 

If you change the concat expression that is inside the pulldata() expression from concat("addr='", ${addr_text},"'") to concat("addr_text='", ${addr_text},"'"), leaving the pulldata() expression like this:
 
pulldata("@layer", "getValue", "attributes.objectid", "<<form service URL here>>", concat("addr_text='", ${addr_text},"'"))
 
 
0 Kudos