Select to view content in your preferred language

Flex API Search - Autocomplete

2783
8
07-31-2012 04:23 PM
ShaunWeston
Frequent Contributor
I am currently looking at ways to implement an autocomplete search for a Flex application I'm building. So the user needs to be able to search for addresses and roads and have the text autocomplete like Googles search.

A co-worker of mine has successfully implemented this through using Flex flash commander and a web service to query the data in SQL server.

I'm thinking there must be better ways to do this, by either querying the map service, using a geocoder or having the data in an XML file.

Previously, I've been doing it through a geocoder, but not sure how you could get a type ahead to work with that.

Any idea on this?
Tags (2)
0 Kudos
8 Replies
MayJeff
Deactivated User
Do you able to complete this task?  If so, would you please share your ideas with me?  Thank you.
0 Kudos
AaronNash1
Frequent Contributor
here is a simple one using an Actionscript file as the database
0 Kudos
AnthonyGiles
Honored Contributor
Shaun,

The search in the header controller can auto predict against a geocode service, or layers in a map service:

http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Header_Controller_widget_tags/0...

Regards

Anthony
0 Kudos
MayJeff
Deactivated User
Aaron - Thank you for this simple example.  Using Actionscript file as the database, you have to keep updating the data to most current one, right?  How about connect to sql database?  Do you have any ideas to do so?

Anthony-  Do you know how to replace text box from esearch with this search in the header controller?

Thank you all.
0 Kudos
AaronNash1
Frequent Contributor
you would need to keep updating it, the data sent was a list of street names. If you created a webservice accessing the data you wish to publish in SQL, then you can use Flash Builder to connect to the web service and use that to autocomplete. The complicated part is just set up the webservice. Here is a tutorial on setting up a webservice that access SQL and linking it to a Flex Application, it is a little out dated but the concepts are there.
0 Kudos
MayJeff
Deactivated User
I will try to then give your a feedback.  I really appreciated your time.  It would nice if someone complete this task.
0 Kudos
AaronNash1
Frequent Contributor
I remember someone actually creating an autocomplete widget that seemed to work well. Attached is the source code and the compiled code that was posted a while ago. I did not write this and it was originally compiled to work in the 2.2 API, may need some updating and tweaking.
0 Kudos
MayJeff
Deactivated User
I try this before but only return limited number of records based on your setting. If you have 120,000 parcels then it will slow down your server.  If can use ideas from geooder would be great just like search box on header controller.
0 Kudos