Select to view content in your preferred language

[URGENT] Inconsistent Data Retrieval in Survey123 Using pulldata()

495
4
05-01-2024 02:40 PM
GabeMcGuire
New Contributor

My team and I are experiencing a critical issue with the pulldata() function in Survey123, which is impacting our governmental operations significantly. Our team uses a form in Survey123 to facilitate staff reviews and actions on various reports. This process is integrated with Experience Builder, where staff are directed to a Survey123 form embedded with a URL parameter (reportguid) that specifies the GUID of the report they are addressing.

The intended functionality is for the survey to retrieve data based on the GlobalID matching the reportguid, display relevant questions according to the report type, and subsequently save responses to our Report Comments table. However, we are experiencing inconsistent behavior with the pulldata() function. Refreshing the survey page results in erratic data retrieval—sometimes pulling the correct report, and other times defaulting to the first report in the system (Object ID of 1).

After extensive troubleshooting, we have determined the issue may be linked to the timing of the data requests. It appears that Survey123 executes a default query "WHERE 1=1" during the pulldata() operation. This query, if it arrives last—after the specific query "WHERE GlobalID= reportguid —results in the survey populating with incorrect data, defaulting to the first available report.

It is unclear why Survey123 initiates the "WHERE 1=1" query, and its presence is causing significant operational disruptions. This issue is of critical importance, and we urgently require assistance to resolve it.

We would greatly appreciate any guidance or solutions you could provide to help us address this problem effectively. I've attached some images below that help illustrate the issue. 

Here is the pulldata portion of the form. 

GabeMcGuire_1-1714598471914.png

When it doesn't work 

notworking.png

 When it works

working.png

 

Notice that the functionality is correct when the specific WHERE request arrives after the default WHERE 1=1 query, and it returns the first object if the WHERE 1=1 query arrives last. The order in which these queries are received appears to be entirely random upon each page refresh.

 

Thank you in advance for any guidance and support you can provide. 

0 Kudos
4 Replies
DougBrowning
MVP Esteemed Contributor

First thing I would try is to take that concat out of pulldata.  pulldata really does not like any calcs in there at all. 

I would also test changing those hidden fields to calculate fields.

Last resort test having the pulldata relevant on the fields in the call not being empty.  Bit of a long shot as they are all calcs.

Hopefully some of that works

 

0 Kudos
AnninaRupe1
Frequent Contributor

@DougBrowning :
Any suggestions on what to use instead of concat if pulldata() doesn't like that? I need to reference a specific phone number which then prints the name and contact information of the person associated with that address. I'm using:

concat("contact_phone='", ${prim_phone},"'")

as the WHERE clause in the pulldata() function. It randomly works.

0 Kudos
DougBrowning
MVP Esteemed Contributor

I think concat in a where clause is ok.  It is suggested here https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-pulldata-quot-laye...

Random works tends to be a special char of some sort in the CSV world.  But I do not use pulldata to a layer much so sorry not sure.

0 Kudos
AnninaRupe1
Frequent Contributor

Thanks for the quick response, @DougBrowning .
@IsmaelChivite ? Any suggestions?

0 Kudos