Hi all,
I’m currently developing a survey in Survey123 Connect, and I’ve encountered an issue when trying to use query parameters in the REST URL within the search() appearance for a select_one question.
According to the documentation, it's possible to filter results from a feature layer by adding a query string directly to the REST URL. However, any filter I apply using the where clause is completely ignored. For example:
search("available?url=https://services2.arcgis.com/xyzxy/arcgis/rest/services/BoatSchedules/FeatureServer/0/query?where=Reservation_Date > CURRENT_TIMESTAMP", "matches", "ScheduleQuery", ${ScheduleQuery}, "Trip_Type", "Public")
This URL returns all records, not just the ones where Reservation_Date > CURRENT_TIMESTAMP.
Curiously, when I add an orderByFields parameter:
search("available?url=https://services2.arcgis.com/xyzxy/arcgis/rest/services/BoatSchedules/FeatureServer/0/query?where=Reservation_Date > CURRENT_TIMESTAMP&orderByFields=Reservation_Date", "matches", "ScheduleQuery", ${ScheduleQuery}, "Trip_Type", "Public")
…the list does return ordered by date, so I know the query string is at least being passed. But the where clause is still not being honored—all records are returned regardless of the date filter.
I’ve confirmed that the query works as expected when tested directly in the REST endpoint, so the issue seems to be specific to how the search() appearance handles the URL in Survey123 Connect.
I checked the request send by the search() appearance on the browser and noticed two QUERY tags appended to the request, both with the query parameters. See attached screenshot. I guess if this is expected behavior.
Also worth noting: the official documentation for search() at
https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformsappearance.htm#ESRI_SECTION1_46A700D2AABF47F1AE4D5004762DB372
has incomplete or incorrect examples for how to properly structure REST query parameters. This may be contributing to the confusion.
Has anyone experienced similar issues or found a workaround? Is this a known limitation or possibly a bug?
Thanks in advance!
MJ