Select to view content in your preferred language

Auto Search text box

2874
10
05-20-2013 07:00 AM
MayJeff
Deactivated User
Does anyone know how to perform a search just like Robert has on his own gis site able to show some autocomplete search information for users. It is a very nice feature. For example, you can just type couple numbers or alpahbets then text box will show you some remaining choices with your input.
Thank you.
Tags (2)
0 Kudos
10 Replies
AnthonyGiles
Honored Contributor
MayMay,

If you don't want to get into having to code your own widget a similar capability is now available in the header control widget:

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

Regards

Anthony
0 Kudos
MayJeff
Deactivated User
Thanks for replying.  I knew that feature too but I would like to add codes to search so able to perform similar way when type on a text box.  Can you give me some ideas how you do it?
0 Kudos
RhettZufelt
MVP Notable Contributor
Jeff,

I have wanted that, but don't see any time available in the future to really look into it.

I know that Mads autocomplete search does this http://forums.arcgis.com/threads/20978-Autocomplete-search-box?highlight=autocomplete and Robert's eSearch uses a paging query (believe this gets past the limited number of returns the service sends) to populate the uniquevaluesfromfield list.  Might be able to utilize one of these for ideas/snippets.

Also, here Robert has posted snippet that loads the services into an array, then the layers of that service into an array.  Might be able to take it a couple steps further and get the fields/attributes into an array as well.  Just a thought.  http://forums.arcgis.com/threads/81057-Aide?p=289399#post289399

Also, I see the selectionwidget http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8 uses a pagingquerytask.as to accomplish this as well.

R_
0 Kudos
BjornSvensson
Esri Regular Contributor
I would like to add codes to search so able to perform similar way when type on a text box.


If you have a service with these codes (in a field), then the header search should work fine. Or maybe I'm misunderstanding something...
0 Kudos
MayJeff
Deactivated User
rzufelt -I still try to work on the ideas you gave.  I will give you a feedback later.  I appreaciate your time.
Bjorn - I try work on similar way header controller has on esearch widget or locate widget.  Haven't got any success yet.  Basically just like google search when you type in a text box, it will give you some char to choose.  Robert has this on his search widget on his GIS site. 
I hope can give a starting point from here.  Thanks all.
0 Kudos
GISDev1
Deactivated User
rzufelt -I still try to work on the ideas you gave.  I will give you a feedback later.  I appreaciate your time.
Bjorn - I try work on similar way header controller has on esearch widget or locate widget.  Haven't got any success yet.  Basically just like google search when you type in a text box, it will give you some char to choose.  Robert has this on his search widget on his GIS site. 
I hope can give a starting point from here.  Thanks all.


I think you are referring to something called 'Autocomplete'.
0 Kudos
MayJeff
Deactivated User
is autocomplete. This thread (http://forums.arcgis.com/threads/20978-Autocomplete-search-box?highlight=autocomplete) perform this autocomplete ability but only return limited number of records.  If you have 120,000 parcels then it will slow down your server.  Would be great if able to directly connect database.  Still thinking.
0 Kudos
RhettZufelt
MVP Notable Contributor
MayMay,

Could be wrong, but I thought I remembered a post by Robert that said he used the pagingQueryTask for his uniquvaluesfromfield as it gets past the limitation by the server.  I know in eSearch, I can get way more results that the service is set to.

R_
0 Kudos
by Anonymous User
Not applicable
I did something different - and used yahoo astra AutocompleteManager.  It handles 350,000 address in a second or two.
I broke the provider xmls into smaller(50,000 address lists) based on the first digit of the address - and, that xml is used in drop down. 
Just a querky way to solve a performance problem - that worked for me.  Partial code below:


xmlns:managers="com.yahoo.astra.mx.managers.*"

<fx:Declarations>
 <managers:AutoCompleteManager   
  maxRowCount="9"
  id="autoCompleteMgr" 
  dataProvider="{myXML.name}"
  target="{txtItem}"
  minCharsForCompletion="1" 
  autoFillEnabled="true"/> 
</fx:Declarations>


\\Based on the first digit of the address . . . it loads a different xml.
    if (clickedInTextInput == true && txtItem.text.length >= 4 && addrSearchVis == true) {
     txtItem.text = txtItem.text.toUpperCase();
     if (int(txtItem.text.charAt(0)) >= 6  && int(txtItem.text.charAt(0)) >= 6) {
      XML_URL = "com/a" + txtItem.text.charAt(0) + ".xml";
     }    
     if (int(txtItem.text.charAt(0)) <= 5) {
      if (int(txtItem.text.charAt(1)) <= 9) {
       XML_URL = "com/a" + txtItem.text.charAt(0) + "8a" + txtItem.text.charAt(0) + "9.xml";
      }
      if (int(txtItem.text.charAt(1)) <= 7) {
       XML_URL = "com/a" + txtItem.text.charAt(0) + "6a" + txtItem.text.charAt(0) + "7.xml";
      }     
      if (int(txtItem.text.charAt(1)) <= 5) {
       XML_URL = "com/a" + txtItem.text.charAt(0) + "4a" + txtItem.text.charAt(0) + "5.xml";
      }
      if (int(txtItem.text.charAt(1)) <= 3) {
       XML_URL = "com/a" + txtItem.text.charAt(0) + "2a" + txtItem.text.charAt(0) + "3.xml";
      }     
      if (int(txtItem.text.charAt(1)) <= 1) {
       XML_URL = "com/a" + txtItem.text.charAt(0) + "0a" + txtItem.text.charAt(0) + "1.xml";
      }    
      
     }          
     var myXMLURL:URLRequest = new URLRequest(XML_URL);
     var myLoader:URLLoader = new URLLoader(myXMLURL);
     myLoader.addEventListener("complete", xmlLoaded);     
    }      
    function xmlLoaded(evtObj:Event):void
    {
     myXML = new XML();
     myXML  = XML(myLoader.data);
     myLoader.removeEventListener("complete", xmlLoaded); 
     autoCompleteMgr.openDropdownForTarget(txtItem);
    } 
0 Kudos