Select to view content in your preferred language

Enhanced Search Widget for FlexViewer 2.1

140363
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
RobertScheitlin__GISP
MVP Emeritus
Nestor,

   I am still struggling with why you are having issues still. I am using the below configuration and am able to get the linkprefix to work in the grid.

<layer>
   <name>Owner Parcels</name>
   <url>http://gis.calhouncounty.org/ArcGIS2/rest/services/parcelviewer/MapServer/67</url>
   <expression useforspatial="false">upper(PPIN) = upper('[value]%')</expression>
   <textsearchlabel>Search Parcel by PPIN... [ Example: 1234 ]</textsearchlabel>
   <graphicalsearchlabel>Use one of the graphical search tools to select Parcel</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
   <titlefield>NAME</titlefield>
   <fields all="false">
    <field name="PPIN" gridfield="true" />
    <field name="NAME" gridfield="true" />
    <field name="STREET_ADDRESS" gridfield="true" />
    <field name="USE_CODE" gridfield="true" />
    <field name="CALC_ACRES" gridfield="true" />
    <field name="EXEMPTION_CODE1" gridfield="true" />
    <field name="ADDRESS_1" gridfield="true" gridfieldonly="true" />
    <field name="ADDRESS_3" gridfield="true" gridfieldonly="true" />
    <field name="PRIOR_TAX_YEAR" gridfield="true" />
    <field name="SALE_DATE" gridfield="true" dateformat="MM/DD/YYYY"/>
    <field name="LAST_DEED_BOOK" gridfield="true"/>
    <field name="LAST_DEED_PAGE" gridfield="true"/>
    <field name="ZIPCODE_1" gridfield="true" gridfieldonly="true"/>
    <field name="NEIGHBORHOOD" gridfield="true" gridfieldonly="true"/>
    <field name="SUBDIVISION" gridfield="true"/>
    <field name="SALE_PRICE" gridfield="true" currencyformat="$|2|,|."/>
    <field name="TOTAL_TRUE" gridfield="true" currencyformat="$|2|,|." />
    <field name="LAND_PRICE" gridfield="true" currencyformat="$|2|,|." />
    <field name="IMPR_PRICE" gridfield="true" currencyformat="$|2|,|." />
    <field name="ADJ_PRICE" gridfield="true" currencyformat="$|2|,|." />
    <field name="OVER_COND" alias="PAPA Website Link" hyperlinkgridfield="true" hyperlinkaliastext="Click Here For PAPA Website" linkprefix="http://www.co.palm-beach.fl.us/PAPA/aspx/web/detail_info.aspx?p_entity=" linksuffix=""/>
   </fields>
   <linkfield linkprefix="http://www.co.palm-beach.fl.us/PAPA/aspx/web/detail_info.aspx?p_entity=" linksuffix="">OVER_COND</linkfield>
   <icon isfield="true"></icon>
   <zoomscale>5000</zoomscale>
  </layer>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Barbara,

   Try this
////////////////////////////////////////////////////////////////////////////////
//
// Version 1.0 - Nov 24, 2010
//
// Delevoped by Robert Scheitlin
//
////////////////////////////////////////////////////////////////////////////////
package com.esri.viewer.utils
{
 public class GlobalVarContainer
 {
  public var vars:Object = {};
  public var searchurl:String = "" ;
  private static var _container:GlobalVarContainer;
  private static var _lock:Boolean = false;
  
  public static function getInstance():GlobalVarContainer
  {
   if (!_lock)
   {
    _container = new GlobalVarContainer();
    _lock = true;
   }
   return _container;
  }
 }
}

and set it like this
GlobalVarContainer.getInstance().searchurl = "Blah blah";

and retrieve it like this
x = GlobalVarContainer.getInstance().searchurl;
0 Kudos
philippschnetzer
Frequent Contributor
I noticed something which I hope is easy to fix because it is quite important to change.  When doing a Spatial Search it only works for features that are actually inside the map extent....if a feature you are including in your search is outside of the visible map area then the tool returns no features.  So, the tool only works for features inside the map extent. 

This should be changed to work like the Text search which does not discriminate with inside or outside of the map extent.

Please help with this....somewhat urgent 🙂

Thanks!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Phillip,

   I will make that configurable in the next release but until then all you have to do is search for this line in the searchwidget.mxml and comment it out.

queryGeom = map.extent; // select entities at screen extent
0 Kudos
philippschnetzer
Frequent Contributor
Thank you very much, Robert!
0 Kudos
JayDira
Emerging Contributor
For the buffer tool in the esearch. How can we change the units to Miles and Feet?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
JR Dira,

     Just add then to the SearchWidget.xml file.

<bufferunits>
  <bufferunit>
   <name>UNIT_STATUTE_MILE</name>
   <label>Miles</label>
  </bufferunit>
  <bufferunit>
   <name>UNIT_FOOT</name>
   <label>Feet</label>
  </bufferunit>
  <bufferunit>
   <name>UNIT_METER</name>
   <label>Meters</label>
  </bufferunit>  
  <bufferunit>
   <name>UNIT_KILOMETER</name>
   <label>Kilometers</label>
  </bufferunit>
 </bufferunits>
0 Kudos
JayDira
Emerging Contributor
THanks Rob,

When I use the spatial buffer, it is providing me the wrong result.
Its seems that, when I do a 10 feet buffer, my results are everything on my current extent.
Any suggestions.
Thanks,
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
JR Dira,

   I can not duplicate your results. What is your spatialReference in your SearchWidget.xml?<spatialReference>102003</spatialReference>
0 Kudos
jaromzenger
Emerging Contributor
Hi,

Great widget! I've seen it work for others but I can't seem to get it working.

When I try to do a search, I am also getting the error #1009, and not just on the layer I've added, but on all the layers included in the complied code (eSearch 2.1.5). I've reduced the number of fields being returned to one, to eliminate the possibility of nulll values and still no luck. I can see that there is data being returned, looking through httpfox, and when I click on the Results Data Grid button there is a list of results. However if I double click on a record in the Results Data Grid nothing happens. I've tried the same layer in the regular Search Widget and it works just fine.

Here is a sample of the content being returned, looking trough httpfox.
{"displayFieldName" : "own_name","fieldAliases" : {"parcel_id" : "parcel_id","own_name" : "own_name","Shape_Length" : "null","Shape_Area" : "null"},"geometryType" : "esriGeometryPolygon","spatialReference" :{"wkid" : 102100},"features" : [{"attributes" : {"parcel_id" : "16342550120000","own_name" : "ZENGER","Shape_Length" : 214.4211829759695,"Shape_Area" : 2805.131731608675},"geometry" :{"rings" : [[[-1.24477245087E7,4967175.067299999],[-1.24477244769E7,4967159.955700003],[-1.24477863521E7,4967159.823899999],[-1.2447786384E7,4967174.935500003],[-1.24477864178E7,4967190.8935],[-1.2447786447999999E7,4967205.1589],[-1.24477245725E7,4967205.2907000035],[-1.24477245087E7,4967175.067299999]]]}}]}

Here is the layer code: 
<layer>
   <name>Parcels-Current Taxyear</name>
   <url>http://gis.slco.org/wwwrest/services/public/Recorder/MapServer/4</url>
   <expression useforspatial="true">parcel_id LIKE upper('[value]%')</expression>
   <textsearchlabel>Search Parcel by Parcel ID... [ Example: 09333760080000]</textsearchlabel>
   <graphicalsearchlabel>Use one of the graphical search tools to select Parcel</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
   <titlefield>parcel_id</titlefield>
   <fields all="false">
    <field name="parcel_id" gridfield="true" />
   </fields>
   <linkfield  linkprefix="" linksuffix=""></linkfield>
   <icon isfield="true"></icon>
   <zoomscale>4000</zoomscale>
   </layer>


Here is the call for the enhanced widget from the config.xml file
 <widget label="Enhanced Search" left="60" top="400"
                icon="assets/images/i_search.png"
                config="widgets/eSearch/SearchWidget.xml"
                url="widgets/eSearch/SearchWidget.swf"/>


What am I missing? Any help would be greatly appreciated. I'm sure I"m over looking something simple.

Jarom
0 Kudos