Autocomplete box formatting of display field
I would like to use an autocomplete box to return more than one field so that i can format the display field string myself.
My workflow requires that the user can use a single autocomplete box to search for features by ID or Name. If i can only display the Name field, if the user searches by ID they will only see the names returned in the dropdown. This is not acceptable for a user as they will probably not know which name matches which id. If i could return multiple fields from the autocomplete query then format the string to present to the user in the dropdown then i could achieve a satisfactory workflow for users.
At the moment, i have two autocomplete boxes on a form, one for ID searches and one for Name searches and a single submit button. This is confusing for the user as they can enter different values in each box which are both fed into the final select features query.
Any thoughts on how i might achieve this? Or whether this is a planned feature?
-
How about creating a new field in your dataset with your desired format already in place as a concatenation of the two fields, such as "Name (ID)".
You could then use that as the Display/Query field and Autocomplete would be able to find either the ID or the name. The ease of doing this and keeping it up-to-date may depend on your datasource i.e database/file and dynamic/static.
If you're using a database and you don't want to or can't modify your existing dataset, you could create a new database view based on that dataset which provides the concatenation field and ID field which you can then use to join the view back onto the original dataset.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
1 kommentar