Search App - Flex Viewer 2.5

2161
15
Jump to solution
08-15-2014 12:30 PM
SeanGambrel
Occasional Contributor II

Hi all,

I'm having trouble with the out-of-the-box Search Widget for Flexviewer 2.5.  We are still running server 9.31.  (Yes, I know its old, we're due for an upgrade soon).

This particular viewer has been up and running fine for several years, but recently we made some structural changes to a joined table that is used by the search widget and have been having trouble ever since.  I'm getting the "400 fault code; check your parameters" message.  I've checked, double checked, and triple checked everything that I can think to, and done quite a bit tinkering but can't get the widget to perform properly.  I've called ESRI support but this is all retired stuff, so they're of limited help.

Here are the highlights:

  • Both the table and the geometry are in SDE.  The user profile that the mapservice was built with has the appropriate permissions to use both.
  • Attribute data from the joined table can be accessed using the Identify Widget in the Flex Viewer, so it seems the join functions and the field names are correct.
  • Similarly, if I open the mapservice as a layer in desktop, I am able to successfully query the layer and the joined table.
  • There are two search "layers", which actually point at the same layer, but two different field.  One field is from the joined table and one is from the polygon geometry.  Neither work.
  • I can change other parameters in the widget and they are reflected in the flexviewer.
  • When I try to query the layer in the API interface using the 1=1 trick, I receive the message "Unable to perform query. Please check your parameters."
  • The search widget is able to query other mapservices though I've only tested with unjoined layers.

Here is the URL for the viewer:

http://gis.bangormaine.gov/parcelviewer/


Here is the URL for the layer in the mapservice:

Parcels - ParcelLines-Dynamic


Here is the code for the widget.  I was a little unsure whether or not the full field name needed to be used, so you'll see the top "layer" uses just the actual field name and the second layer uses the full SDE name.  Neither works at this point.

<configuration label="Parcel Finder">

    <initialview>text</initialview>

<layers>

<layer>

        <name>By Address</name>

        <url>http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0</url>

        <expression>gisdata.GISADMIN.PARCELDATA.PROP_ADD like '%[value]%'</expression>

        <textsearchlabel> [Example: 123 MAIN ST]</textsearchlabel>

        <titlefield>PROP_ADD</titlefield>

        <linkfield></linkfield>

        <fields all="true">

            <field name="PROP_ADD" alias="Address"/>

             <field name="OWNER1" alias="Owner"/>

             <field name="MAPLOTUNIT" alias="Map-Lot Number"/>

             <field name="TAX_ACCT" alias="Account"/>

        </fields>

    </layer>

<layer>

        <name>by Map-Lot Number</name>

        <url>http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0</url>

        <expression>MAPLOTUNIT = '[value]'</expression>

        <textsearchlabel>[Example: 001-001-A]</textsearchlabel>

        <titlefield>MAPLOTUNIT</titlefield>

        <linkfield></linkfield>

        <fields all="false">

            <field name="gisdata.GISADMIN.PARCELDATA.PROP_ADD" alias="Address"/>

             <field name="gisdata.GISADMIN.PARCELDATA.OWNER1" alias="Owner"/>

             <field name="gisdata.GISADMIN.Parcels.MAPLOTUNIT" alias="Map-Lot Number"/>

             <field name="gisdata.GISADMIN.Parcels.TAX_ACCT" alias="Account"/>

        </fields>

    </layer>

</layers>

<labels>

      <graphicalsearchlabel>Identify Parcels</graphicalsearchlabel>

      <textsearchlabel>Search for Parcels</textsearchlabel>

</labels>

<symbols>

      <simplefillsymbol color="0xFF0000" alpha="0.0"/>

      <outline color="0xFF0000"alpha="1.0" width="5"/>

</symbols>

<zoomscale>9600</zoomscale>

</configuration>

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Sean,

   The Identify Widget uses a different Flex Task to get the info, the identifyTask vs the QueryTask, so it is not surprising that one works and the other does not. As far as being able to identifying the service in ArcCatalog same thing goes for that it is a different REST endpoint that is being hit for that.

      Querying fro the Rest end point is simple. The end point provides a web form for you to specify the where clause, returned fields, etc. Just go to this url: http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0/query‌ and fill in the required form fields.

After closely looking at your fields for this layer I notice that the ObjectId and the Shape fields are not listed, this is a big issue as both of these fields are required for a query to work. If you go back into the mxd and un-hide this fields and re-publish again, I bet you will be back in business.

View solution in original post

15 Replies
RobertScheitlin__GISP
MVP Emeritus

Sean,

   The map service itself is hosed. I can not even get a query to work on the REST service directory page. You need to delete this map service and republish it.

SeanGambrel
Occasional Contributor II

Hi Robert,

Thanks for weighing in.  I have re-published the service several times, but am still also unable to query the map service.  I read somewhere that perhaps the number of records returned on the "1=1" query causes the error,  and am not familiar enough with querying via the REST interface to diagnose a problem via a different query there.

Interestingly, despite the REST query problem and the search widget problem, the map service works fine using the identify widget - it returns the correct values among all of the specified fields.

I an also preview the service (not the original mxd, but the service itself) in catalog and return the correct results via the identify tool.

Any other thoughts?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sean,

   The Identify Widget uses a different Flex Task to get the info, the identifyTask vs the QueryTask, so it is not surprising that one works and the other does not. As far as being able to identifying the service in ArcCatalog same thing goes for that it is a different REST endpoint that is being hit for that.

      Querying fro the Rest end point is simple. The end point provides a web form for you to specify the where clause, returned fields, etc. Just go to this url: http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0/query‌ and fill in the required form fields.

After closely looking at your fields for this layer I notice that the ObjectId and the Shape fields are not listed, this is a big issue as both of these fields are required for a query to work. If you go back into the mxd and un-hide this fields and re-publish again, I bet you will be back in business.

SeanGambrel
Occasional Contributor II

BINGO!  That's all it took was un-hiding both of those fields.  Everything works now as expected!

Well, almost.  I'm getting some odd returns, but I think I've come across this before - basically the same several hundred features are being returned along with the correct return.  I'll look back at some old threads and see if I can remind myself of the solution.  I'll post it here as a follow-up.

Thanks Robert!  Your expertise is invaluable here on these forums.  I hope ESRI is giving you a cut of their support fees...   

SeanGambrel
Occasional Contributor II

Hmmm.  Not coming up with anything right off the bat.  Maybe this is a quick fix?

Every search using address returns 500 results, though luckily the results which satisfy the search query show up at the top.  If I use map-lot number it only returns the matching records.  Two major differences are:

1) the address data is located in the joined table whereas the map-lot number is in the feature geometry 
2) the address query uses the "like" function whereas the map-lot query uses the = operator. 

Any idea why this might be happening?

my query syntax is <expression>PROP_ADD like '%[value]%'</expression>

Thanks!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sean,

   Testing these REST End Point Queries I see that if I return all the fields then I get 500 records for this search:

http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0/query?text=&geometry...

But if I specify the outfields specifically then I get just the one result I am looking for:

http://gis.bangormaine.gov/ArcGIS/rest/services/ParcelLines-Dynamic/MapServer/0/query?text=&geometry...

SeanGambrel
Occasional Contributor II

Interesting.  It doesn't appear that I can change that variable in the widget configuration (I do have it set to only display certain fields, but I think that's more of a display setting, post-query).

The odd thing is that this used to work fine with a nearly identical table.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sean,

   In your SearchWidget.xml you need to change your fields tag to this:

<fields all="false">

SeanGambrel
Occasional Contributor II

I tried that but it still returned 500 results.

0 Kudos