Select to view content in your preferred language

Enhanced Search Widget for FlexViewer 2.1

110073
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
MikeHargreaves
Emerging Contributor
Thanks Robert.  I tried the compiled version, and I'm finding that the results have no fields displaying.  If I use the gridfield and gridfieldonly attributes, they seem to behave properly when I open the grid.  If I put in a titlefield, then that will display in the results...  Any ideas?
0 Kudos
MikeHargreaves
Emerging Contributor
In addition, when I tried to do a spatial search, I got the following error...

SecurityError: Error #2048: Security sandbox violation: http://agsmaps.ci.santa-rosa.ca.us/flexviewer/index.swf cannot load data from http://gis.calhouncounty.org/arcgis2/rest/services/Geometry/GeometryServer/buffer.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mike,

   Can you provide me with more details on your configuration? Maybe provide me with the whole layer configuration like in this example

<layer>
   <name>Traffic Cameras</name>
   <url>http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_PublicSafety_Louisville/MapServer/2</url>
   <expression>upper(DESCRIPTION) LIKE upper('[value]%')</expression>
   <textsearchlabel>Search Traffic Cameras by Location... [ Example: I-71 ]</textsearchlabel>
   <graphicalsearchlabel>Use one of the graphical search tools to select Traffic Cameras</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
   <fields all="false">
    <field name="DESCRIPTION" alias="Description" gridfield="true" />
    <field name="URL" alias="Show Image" hyperlinkgridfield="true" hyperlinkaliastext="Get Traffic Image"/>
    <field name="ONLINE" alias="Online" gridfield="true" gridfieldonly="true"/>
    <field name="LAST_UPDATED" alias="Last Updated" gridfield="true" gridfieldonly="true"/>
   </fields>
   <titlefield>DESCRIPTION</titlefield>
   <linkfield>URL</linkfield>
   <zoomscale>5000</zoomscale>
  </layer>

As far as the spatial query error that is a simple fix that I will change in the download for others but you can fix that easily by replace my servers url with a esri server url

Find the line in the SearchWidget.xml that has the geometryService and put this
<geometryservice>http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer</geometryservice>
0 Kudos
philippschnetzer
Frequent Contributor
thank you!!  now I can stop my frivolous attempt to update the Parcel Notification Widget to work in 2.1....because that was not going so well....

Only one issue I am having...when I click the 'Use existing Draw Widget Graphics' a response comes 'There are no graphics currently available'.  And also I am missing the icon for that but that's not an issue.

I did add graphicsLayer.id = "myGraLay";, and graphicsLayer.name = "myGraLay"; to the drawwidget.mxml (at line 246).

thanks again, and Erwan Caradec as well, for this powerful addition - this is the kind of tool that makes a map analytical!!
0 Kudos
SamBishop
Deactivated User
Robert / Erwan - nice looking widget.  But am I right in thinking that the default search tool automatically displays a field's alias in the search tool widget?  You only need define an alias attribute if you want to override the field alias. From my perspective it would be useful if your enhanced search widget could replicate this in the results grid.

Also I'm only seeing the contents of the <titlefield> tag in the search widget itself...

Here is one of my layers:

<layer>
  <name>GCR - Geological Conservation Review Site</name>
  <url>http://uk-abz-app10/ArcGIS/rest/services/env/envtest/MapServer/1</url>
  <expression>UPPER("NAME") LIKE UPPER('%[value]%')</expression>
  <textsearchlabel>Enter a GCR Review Site Name:</textsearchlabel>
  <graphicalsearchlabel>Select a search tool:</graphicalsearchlabel>
  <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
  <spatialsearchlayer>true</spatialsearchlayer>
  <spatialrelationlayer>true</spatialrelationlayer>
  <titlefield>NAME</titlefield>
  <linkfield>CODELINK</linkfield>
  <fields all="false">
    <field name="CODE" alias="Code" gridfield="true"/>
    <field name="NAME" alias="Name" gridfield="true"/>
    <field name="COUNTRY" alias="Country" gridfield="true"/>
    <field name="BLOCK" alias="Block" gridfield="true"/>
    <field name="LOCAL_AUTH" alias="Local Authority" gridfield="true"/>
    <field name="GRID_REF" alias="Grid Ref." gridfield="true"/>
    <field name="EASTING" alias="Easting" gridfield="true"/>
    <field name="NORTHING" alias="Northing" gridfield="true"/>
    <field name="CODELINK" alias="Link" hyperlinkgridfield="true" hyperlinkaliastext="Link to JNCC data"/>
  </fields>
</layer>


Many thanks
Sam
0 Kudos
AlexJones
Emerging Contributor
Thank you! I will keep my eyes out for the updated code. Please let me know if you need another person to test it out.
0 Kudos
MikeHargreaves
Emerging Contributor
Thanks Robert - I had just assumed the Geometry service was burried in the code without looking more closely at the xml file.  Here is my version:

<layers>      
  <layer>
            <name>Addresses</name>
            <url>http://agsmaps.ci.santa-rosa.ca.us/ArcGIS/rest/services/MiscLayersExt/MapServer/4</url>
            <expression>FullAddr LIKE '%[value]%'</expression>
            <textsearchlabel>Search by Address  [ Example: 100 Santa Rosa Ave ]:</textsearchlabel>
            <graphicalsearchlabel>Use one of the graphical search tools to select Addresses</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
            <titlefield>ASMT</titlefield>
            <linkfield></linkfield>
            <fields all="false">
    <field name="FullAddr" alias="Address"/>
            </fields>
        </layer>
  <layer>
            <name>Landmarks</name>
            <url>http://agsmaps.ci.santa-rosa.ca.us/ArcGIS/rest/services/MiscLayersExt/MapServer/8</url>
            <expression>NAME LIKE '%[value]%'</expression>
            <textsearchlabel>Search by Name  [ Example: school ]:</textsearchlabel>
            <graphicalsearchlabel>Use one of the graphical search tools to select landmarks</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
            <titlefield>ASMT</titlefield>
            <linkfield>URL</linkfield>
            <fields all="false">
    <field name="NAME" alias="Name"/>
    <field name="TYPE" alias="Type"/>
    <field name="URL" alias="Link"/>
            </fields>
        </layer>
  <layer>
            <name>Parcels</name>
            <url>http://agsmaps.ci.santa-rosa.ca.us/ArcGIS/rest/services/Parcels/MapServer/0</url>
            <expression>ASMT LIKE '[value]%'</expression>
            <textsearchlabel>Search by APN  [ Example: 009191021 ]:</textsearchlabel>
            <graphicalsearchlabel>Use one of the graphical search tools to select parcels</graphicalsearchlabel>
   <spatialsearchlabel>Select the two layers for spatial query</spatialsearchlabel>
   <spatialsearchlayer>true</spatialsearchlayer>
   <spatialrelationlayer>true</spatialrelationlayer>
            <titlefield></titlefield>
            <linkfield></linkfield>
            <fields all="false">
    <field name="ASMT" alias="APN" gridfield="true" gridfieldonly="false"/>
    <field name="SITUS_ADDRESS" alias="Address" gridfield="true" gridfieldonly="false"/>
            </fields>
        </layer>
</layers>
0 Kudos
LeeAllen
Frequent Contributor
Robert / Erwan - nice looking widget.  But am I right in thinking that the default search tool automatically displays a field's alias in the search tool widget?  You only need define an alias attribute if you want to override the field alias. From my perspective it would be useful if your enhanced search widget could replicate this in the results grid.

Also I'm only seeing the contents of the <titlefield> tag in the search widget itself...


Sam


Getting same results.  I need to show at least 2 to 3 fields in the search widget results (address, owner, parcel id) and have these in the data grid along with other fields. (BTW, thanks for this widget!)
0 Kudos
EricVenden
Frequent Contributor
Nice work Robert,
It appears I am missing an image file...when I select the "Graphical Search" option. The far-left icon appears to missing?  I believe I have installed the widget properly.

I have attached a screen shot.
Any help would be appreciated.
0 Kudos