Hey all,
Hoping someone can help figure out why the search() function isn't working as documented.
Overview
I have a hosted feature layer that contains a parent table with event details, and a child table which has attendees that can be recorded for that event via a repeat.
I'm trying to put together a search query that can generate a list of attendees for a specific event based on parentglobalid's.
Looking at the documentation for the search() function, an example query was the following:
search('csvName', 'matches', 'breed', ${DogQuestion})
I put together a very similar query as follows (except I call the related table instead of a csv):
search('example_search?url=<REST url>/FeatureServer/3', 'matches', 'parentglobalid', ${parentglobalid})
The searchColumn "parentglobalid" is the name of the field in the related table, and the searchText of ${parentglobalid} refers to a question in the survey that stores the parentglobalid.
In theory, this should work however it returns a list of all records from the attendance field instead of just the ones that match the parentglobalid:

To check that this search query is correct, I replaced ${parentglobalid} with an actual value for a parentglobalid in the feature layer and this worked as expected - only attendees for that specific event were returned:
search('example_search?url=<REST url>/FeatureServer/3', 'matches', 'parentglobalid', '57ad118f-bcb0-41a1-8268-c2d2b7f79512')

It seems the search() function only works when the searchText is a string enclosed in quotes (static), however the documentation shows that it can reference a field (dynamic) but that's not working in my case.
Troubleshooting Attempts
The things I've tried are the following (none of them worked):
- Create a separate text question that stores the parentglobalid a second time and call that in the search() function
- In that separate text question, ensure the parentglobalid is a string and call that in the search() function
- In that separate text question, enclose the parentglobalid with quotation marks ( concat("'", ${parentglobalid}, "'") ) and call that in the search() function
- Call a completely irrelevant field as the serachText value which still returns the entire list
- Have a separate calculate question that stores the ensure search() function and have the appearance call that calculated value
- Have a separate calculate question that stores the body of the search() function and have the appearance call the calculate within the search function (e.g., search(${search_body})
Hopefully I'm missing something straightforward and this is a quick fix. Or maybe it's not possible to run the search() function using parentglobalid's, however it just doesn't seem to want to work when calling a field dynamically.
Any help or advice would be much appreciated!