Select to view content in your preferred language

Enhanced Search Widget for FlexViewer 2.1

110621
767
10-25-2010 02:13 PM
RobertScheitlin__GISP
MVP Emeritus
All Here is my next widget in the FlexViewer 2.1 series

Special thanks to Erwan Caradec for contributing to this code.

The Enhanced Search Widget extends the standard search widget with a floating data grid and a new spatial query w/buffering.

http://www.arcgis.com/home/item.html?id=5d4995ccdb99429185dfd8d8fb2a513e
Tags (2)
0 Kudos
767 Replies
HalilSiddique
Frequent Contributor
Hi Robert,

Is it possible to use a a wildcard on a text search, in the out of the box the '%' is used, but cant seem to get it working on your widget.
Any ideas?

Halil
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Halil,

  If you look at the documentation or the SearchWidget.xml that come with the widget you will see several examples of wildcard searches that work.

<expression alias="Zoning Name" textsearchlabel="Search Zoning Name [ Example: RES MULTI-FAMILY ]:">upper(ZONING_NAME) LIKE upper('%[value]%')</expression>


If for some reason you are publishing shapefiles (not a very good idea) than your wildcard would be * and not %.
0 Kudos
HalilSiddique
Frequent Contributor
Halil,

  If you look at the documentation or the SearchWidget.xml that come with the widget you will see several examples of wildcard searches that work.

<expression alias="Zoning Name" textsearchlabel="Search Zoning Name [ Example: RES MULTI-FAMILY ]:">upper(ZONING_NAME) LIKE upper('%[value]%')</expression>


If for some reason you are publishing shapefiles (not a very good idea) than your wildcard would be * and not %.


Thanks Robert.
0 Kudos
HalilSiddique
Frequent Contributor
Robert, just a another thing that I have just thought of is, is it possible to do a search between 2 different dates. I have a planning application layer to a date field, and my user wants to select 2 dates and show the features within the 2 dates. I've had a look at the docs. but cant see anything.

Cheers

Halil
0 Kudos
StuartBlumberg
Emerging Contributor
Robert,

Where in the code would I need to change it so when I do a graphical search I could repeat the action rather than having to click on the graphical search tool again?  Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Halil,

   Searching by 2 variable is not supported out of the box in this widget. But if you look a couple of post above you will see a link to how some people have added that option.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Stuart,

   That was a little more difficult than I though it was going to be...


   private function searchDrawEnd(event:DrawEvent):void
   {
    //selectedDrawingIcon = null;
    //clearSelectionFilter();
    
    // deactivate the draw tool
    event.target.deactivate();
    var geom:Geometry = event.graphic.geometry;
    clearBuffer();
    if (geom is Polygon && GeometryUtil.polygonSelfIntersecting(geom as Polygon))
    {
     geometryService.simplify([geom], new AsyncResponder(simpResult, null));
     function simpResult(item:Object ,spatialRelat:String):void{
      var simpGeoms:Array = item as Array;
      queryFeaturesGraphical(simpGeoms[0] as Polygon,"esriSpatialRelIntersects",configSearchGraphical[cboLayerGraphical.selectedIndex]);
     }
    }else{
     //create extent around map point to improve search results
     if (geom.type == Geometry.MAPPOINT && addTolerance.selected)
     {
      geom = createExtentAroundMapPoint(geom as MapPoint, pointSearchTolerance);
     }
     queryFeaturesGraphical(geom, "esriSpatialRelIntersects",configSearchGraphical[cboLayerGraphical.selectedIndex]);
    }
    
    var status:String;
    var value:String = selectedDrawingIcon.name;
    switch (value)
    {
     case DrawTool.MAPPOINT:
     {
      status = pointLabel;
      drawSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 15, 0x3FAFDC, 1);
      break;
     }
     case DrawTool.POLYLINE:
     {
      status = lineLabel;
      drawSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 0x3FAFDC, 1, 1);
      break;
     }
     case DrawTool.EXTENT:
     {
      status = rectangleLabel;
      drawSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0x3FAFDC, 0.5, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 0x3FAFDC, 1, 1));
      break;
     }
     case DrawTool.POLYGON:
     {
      status = polygonLabel;
      drawSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0x3FAFDC, 0.5, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 0x3FAFDC, 1, 1));
      break;
     }
    }
    setMapAction(value, status, drawSymbol, searchDrawEnd);
   }


Your problem is going to be deactivating. If you close the widget or choose another tool it will deactivate.
0 Kudos
StuartBlumberg
Emerging Contributor
Wow, Robert, I though it was way simpler than that, thank you!!
Also, have you been able to duplicate the date issue?
0 Kudos
deleted-user-RjoC4IOGTpoH
Deactivated User
Good Morning Robert,
Hope all is well.

A few versions ago I had inquired about adding the tag that would enable all the fields to be displayed in the gridfield if the <fields all="true"> is set. Something along the lines of <fields all="true gridfields all="true">. Was this ever implemented and not documented? I am running into a need for it now.

Thanks in advance !!

Nestor.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nestor,

   No I never added that option as it is a lot more involved than you would think. For the grid to be able to display all the field the QueryTask would have to query and return all the fields and a lot of re-factoring of the code would have to occur. I am not saying that the enhancement has been declined but it does have a low priority.
0 Kudos