I am having trouble using the search(function) to narrow down the options in a select_multiple_from_file question.
I have a select_one question where the user selects a plot #. Using a choice_filter, this narrows down the choices of tags to those that occur within the selected plot. The tags are listed in a csv that is in the media folder; it is called t.csv.
I want the user to be able to further reduce the tag options available for the select_multiple_from_file t.csv question. I created a text question called filterTags.
In the appearance column for the select_multiple_from_file t.csv question I put: search('t', 'label', ${filterTags}).
No matter what I try, I am not getting the search() function to work at all, in any way shape or form.
I am using Surevy123 Connect version 3.14.281.
Solved! Go to Solution.
One last update: Since you cannot combine search() with a choice filter, I combined 2 choice filters to achieve the desired behavior.
choice_filter = if(${parentTag} = '', selected(${plot}, AsMi_plot_id), selected(${plot}, AsMi_plot_id) and selected(${parentTag}, parentTag))
I think you're missing the searchType Parameter which is confusing the rest of the Parameters.
How the search copes with multiple tags to narrow-down and multi choice list I'm not sure.
possibly:
#per help doc hyperlinked example
#supported search types are contains, startswith,
#endswith, and matches
#search('csvName', 'matches', 'breed', ${DogQuestion})
#your appearance
search('t', 'contains', 'label', ${filterTags})
You may also just want to instead have a type 'select_multiple_from file t.csv' and set the appearance to minimal 'autocomplete' instead and do away with the tags question.
Parameter Description
searchType | Controls what type of search is performed, and accepts different values depending on whether the table being searched is a spatial table within a feature layer or a nonspatial table in a CSV or feature table. For spatial tables, the accepted search types are intersects, contains, crosses, envelope_intersects, index_intercepts, overlaps, touches, and within. To learn more, see Spatial relationships. For a nonspatial table, the supported search types are contains, startswith, endswith, and matches. |
searchColumn | Determines the column that will be searched for the text in the searchText parameter. These columns are taken from the table itself. In addition, a spatial table in a feature layer can search the columns @geopoint, @geotrace, and @geoshape. |
searchText | Contains the text that will be searched for and returned in the searchColumn parameter. |
Thanks @DavidPike . Adding the searchType parameter did not solve the issue.
I can see why you would suggest switching to an autocomplete, but I am kind of co-opting the select multiple to display a list of data from previous years, per the end user's needs, and the select multiple type helps them check off the plants they have measured as they go.
Is it required that the csv I am referencing (t.csv in this case) be a hosted feature on ArcGIS Online?? Right now, I am still in development phase in Surevy123 Connect and have it saved in the media folder.
I think I have figured it out and it seems that you cannot combine a choice_filter with the select() function. In my earlier file, I hadn't put the name of the csv file in the choices tab, so that was causing all my tests to fail. But not that I have gotten a basic search() function, I have landed on the likely answer is that the choice_filter makes it impossible
One last update: Since you cannot combine search() with a choice filter, I combined 2 choice filters to achieve the desired behavior.
choice_filter = if(${parentTag} = '', selected(${plot}, AsMi_plot_id), selected(${plot}, AsMi_plot_id) and selected(${parentTag}, parentTag))
Glad you solved it. No I don't believe so, my understanding is that it's hosted in ArcGIS Online to allow it to be downloaded as part of the Survey (as 'Linked Content') by users - and then referenced locally on the device thereafter (until CSV is updated then downloaded again).