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

129
1
2 weeks ago
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
1 Reply
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