Select to view content in your preferred language

Enhanced Search: Multiple Relate Layers?

1102
10
Jump to solution
01-25-2012 12:14 PM
JimLucht
Emerging Contributor
Hi Folks

I'm trying to get the most out of the super-cool enhanced search widget through a very simple data model. The service contains four iterations of the same parcel shapefile (narrowed by definition queries) that provide useful map and query layers. I want to relate all of them to a single dbf that contains Deeds data. I would eventually want to relate each of them to multiple tables (taking advantage of that intermediate relate-picker screen), but Deeds is enough for now.

The problem I'm having is that while the first layer pulls up related records just fine, the other three layers do not- the relate records icon appears but clicking gives no response (no "No related records found" window, nothing).

The Enhanced Search example provides an illustration of search function for multiple individual layers, one of which as relates enabled (Road Centerlines). It does not show relates enabled on multiple layers.

SO, my question is: Is the Enhanced Search widget geared to provide relates on multiple layers? If so, my code is probably screwed up somewhere but it seems like it should work. Do I need to move to a file geodatabase?

Any help is greatly appreciated!

Test Site: http://mapper.provplan.org/flexviewers/parcelmapper3/

Service (does that relate code with the Deeds relate repeated seem right? In the mxd it has only one relate per layer):
http://mapper.provplan.org/ArcGIS/rest/services/parcel_detail3q/MapServer

Thanks!

Jim

shortened eSearch widget xml:

<?xml version="1.0" ?> <!-- See Enhanced Search Widget XML Configuration.pdf for detailed explanation -->  <configuration>  <layers>   <layer>    <definitionexpression></definitionexpression>    <enableexport>true</enableexport>    <name>Parcels</name>    <url>http://mapper.provplan.org/ArcGIS/rest/services/parcel_detail3q/MapServer/0</url>    <expressions>    <expression alias="Owner Name"      textsearchlabel="Search Owner Name [ Example: smith or Smith ]:">upper(OWNER) LIKE upper('%[value]%')</expression>     <expression alias="Address"      textsearchlabel="Search Address [ Example: 70 Homer ]:">upper(LOCATION) LIKE upper('%[value]%')     </expression>     <expression alias="Plat Lot"      textsearchlabel="Search Plat Lot [ Example: 59 266 ]:">upper(PL) LIKE upper('%[value]%')     </expression>    </expressions>    <graphicalsearchlabel>Use one of the graphical search tools to select     Parcels</graphicalsearchlabel>    <spatialsearchlayer>true</spatialsearchlayer>    <titlefield>LOCATION</titlefield>    <fields all="false">     <field name="LOCATION" alias="Property Address" gridfield="true"/>     <field name="PL" alias="Plat Lot" gridfield="true"/>     <field name="CLASS_DEF" alias="Tax Class" gridfield="true"/>     <field name="OWNER" alias="First Owner" gridfield="true"/>     <field name="OWNER2" alias="Second Owner" gridfield="true"/>     <field name="ZCIVIC" alias="Own StrNum" gridfield="true" gridfieldonly="true"/>     <field name="STREET" alias="Own Str" gridfield="true" gridfieldonly="true"/>     <field name="S_SUFFIX" alias="Type" gridfield="true" gridfieldonly="true"/>     <field name="UNIT" alias="Own Unit" gridfield="true" gridfieldonly="true"/>     <field name="ADD_LINE_B" alias="Own Add1" gridfield="true" gridfieldonly="true"/>     <field name="CITY" alias="Own City" gridfield="true" gridfieldonly="true"/>     <field name="STATE" alias="Own State" gridfield="true" gridfieldonly="true"/>     <field name="ZIP_POSTAL" alias="Own Zip" gridfield="true" gridfieldonly="true"/>     <field name="YR_BUILT" alias="Year Built" gridfield="true" gridfieldonly="true"/>     <field name="EST_RUNITS" alias="Res Units" gridfield="true" gridfieldonly="true"/>     <field name="HSOO" alias="Own Occ 1" gridfield="true" gridfieldonly="true"/>     <field name="NHOOD" alias="Neighborhood" gridfield="true" gridfieldonly="true"/>     <field name="WARD" alias="Ward 2011" gridfield="true" gridfieldonly="true"/>     <field name="CARDURL" alias="Property Card" gridfield="false" hyperlinkgridfield="true" hyperlinkaliastext="Show Card"/>     <field name="PICURL" alias="Photo" gridfield="false" hyperlinkgridfield="true" hyperlinkaliastext="Show Photo"/>    </fields>    <links>     <link includeinresults="false" field="CARDURL" alias="Click for property card">      <linkprefix></linkprefix>      <linksuffix></linksuffix>      <iconfield></iconfield>      <iconprefix></iconprefix>      <iconsuffix>assets/images/i_info.png</iconsuffix>     </link>     <link includeinresults="false" field="PICURL" alias="Click for photo">      <linkprefix></linkprefix>      <linksuffix></linksuffix>      <iconfield></iconfield>      <iconprefix></iconprefix>      <iconsuffix>assets/images/i_camera.png</iconsuffix>     </link>    </links>    <zoomscale usegeometry="true">10000</zoomscale>    <relates>     <relate id="0" label="Deeds Data" enableexport="true">      <fields all="false">       <field name="PL"/>       <field name="PLAT/LOT"/>       <field name="INSTRUMENT"/>       <field name="GRANTOR" />       <field name="GRANTEE" />       <field name="SALEPRICE"/>       <field name="SALEDATE" dateformat="MM/DD/YYYY"/>       <field name="DEEDBOOK"/>       <field name="DEEDPAGE"/>      </fields>     </relate>    </relates>   </layer> <layer>    <definitionexpression></definitionexpression>    <enableexport>true</enableexport>    <name>Non Owner-Occ. Single and 2-5</name>    <url>http://mapper.provplan.org/ArcGIS/rest/services/parcel_detail3q/MapServer/1</url>    <expressions>    <expression alias="Owner Name"      textsearchlabel="Search Owner Name [ Example: smith or Smith ]:">upper(OWNER) LIKE upper('%[value]%')</expression>     <expression alias="Address"      textsearchlabel="Search Address [ Example: 70 Homer ]:">upper(LOCATION) LIKE upper('%[value]%')     </expression>     <expression alias="Plat Lot"      textsearchlabel="Search Plat Lot [ Example: 59 266 ]:">upper(PL) LIKE upper('%[value]%')     </expression>    </expressions>    <graphicalsearchlabel>Use one of the graphical search tools to select     Properties</graphicalsearchlabel>    <spatialsearchlayer>true</spatialsearchlayer>    <titlefield>LOCATION</titlefield>    <fields all="false">     <field name="LOCATION" alias="Property Address" gridfield="true"/>     <field name="PL" alias="Plat Lot" gridfield="true"/>     <field name="CLASS_DEF" alias="Tax Class" gridfield="true"/>     <field name="OWNER" alias="First Owner" gridfield="true"/>     <field name="OWNER2" alias="Second Owner" gridfield="true"/>     <field name="ZCIVIC" alias="Own StrNum" gridfield="true" gridfieldonly="true"/>     <field name="STREET" alias="Own Str" gridfield="true" gridfieldonly="true"/>     <field name="S_SUFFIX" alias="Type" gridfield="true" gridfieldonly="true"/>     <field name="UNIT" alias="Own Unit" gridfield="true" gridfieldonly="true"/>     <field name="ADD_LINE_B" alias="Own Add1" gridfield="true" gridfieldonly="true"/>     <field name="CITY" alias="Own City" gridfield="true" gridfieldonly="true"/>     <field name="STATE" alias="Own State" gridfield="true" gridfieldonly="true"/>     <field name="ZIP_POSTAL" alias="Own Zip" gridfield="true" gridfieldonly="true"/>     <field name="YR_BUILT" alias="Year Built" gridfield="true" gridfieldonly="true"/>     <field name="EST_RUNITS" alias="Res Units" gridfield="true" gridfieldonly="true"/>     <field name="HSOO" alias="Own Occ 1" gridfield="true" gridfieldonly="true"/>     <field name="NHOOD" alias="Neighborhood" gridfield="true" gridfieldonly="true"/>     <field name="WARD" alias="Ward 2011" gridfield="true" gridfieldonly="true"/>     <field name="CARDURL" alias="Property Card" gridfield="false" hyperlinkgridfield="true" hyperlinkaliastext="Show Card"/>     <field name="PICURL" alias="Photo" gridfield="false" hyperlinkgridfield="true" hyperlinkaliastext="Show Photo"/>    </fields>    <links>     <link includeinresults="false" field="CARDURL" alias="Click for property card">      <linkprefix></linkprefix>      <linksuffix></linksuffix>      <iconfield></iconfield>      <iconprefix></iconprefix>      <iconsuffix>assets/images/i_info.png</iconsuffix>     </link>     <link includeinresults="false" field="PICURL" alias="Click for photo">      <linkprefix></linkprefix>      <linksuffix></linksuffix>      <iconfield></iconfield>      <iconprefix></iconprefix>      <iconsuffix>assets/images/i_camera.png</iconsuffix>     </link>    </links>    <zoomscale usegeometry="true">10000</zoomscale>    <relates>     <relate id="0" label="Deeds Data" enableexport="true">      <fields all="false">       <field name="PL"/>       <field name="PLAT/LOT"/>       <field name="INSTRUMENT"/>       <field name="GRANTOR" />       <field name="GRANTEE" />       <field name="SALEPRICE"/>       <field name="SALEDATE" dateformat="MM/DD/YYYY"/>       <field name="DEEDBOOK"/>       <field name="DEEDPAGE"/>      </fields>     </relate>    </relates>   </layer>   -----code truncated-------  </configuration>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Jim,

   OK doing some testing reveals you have so pretty big issues here with your relates... The Shape file use FID and it also has an ObjectID field and then your relate table has ObjectID and an OID field.

Well when you query the shapefile for FID = 30 than you get one result as expected and that record has an ObjectID of 3250. Using the REST Service directory page and you choose query related records and use the FID of 30 for the ObjectID to query you get no result but when you use 3250 you do get a result. Well this is a big issue because my widget would be trying to query the FID for 30 as you would normally do and the way you have the relate setup that will never produce results.


And Yes you should never be publishing a shapefile for a mapservice, although you can, you just should not. Go ahead and make the change to file geodatabase.

View solution in original post

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus
Jim,

   I have only had a super quick glance but I believe that the relate ID should be 4:

<relate id="4" label="Deeds Data" enableexport="true">
0 Kudos
JimLucht
Emerging Contributor
Hi Robert

Thanks for taking a look. Alas, no luck. I changed the relate IDs to 4 with no success (always clearing cache, refreshing, etc). The first layer "Parcels" stopped relating records as well. I changed the Parcels relate ID back to 0 and it started working again.

Does anything else come to mind? The way the relationships are listed in the service (under all four layers) seems odd:

Relationships:
deeds (0) -- Related To: deeds (4)
deeds (1) -- Related To: deeds (4)
deeds (2) -- Related To: deeds (4)
deeds (3) -- Related To: deeds (4)

There is only one relate for each layer in the mxd, but all layers are based on the same shapefile. I renamed and query-defined each layer before setting up the relates. Both the server and desktop service packs are all up to date. I wonder if a file geodatabase would behave differently? Not sure. Any ideas are welcome!

Many thanks,

Jim
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jim,

   OK doing some testing reveals you have so pretty big issues here with your relates... The Shape file use FID and it also has an ObjectID field and then your relate table has ObjectID and an OID field.

Well when you query the shapefile for FID = 30 than you get one result as expected and that record has an ObjectID of 3250. Using the REST Service directory page and you choose query related records and use the FID of 30 for the ObjectID to query you get no result but when you use 3250 you do get a result. Well this is a big issue because my widget would be trying to query the FID for 30 as you would normally do and the way you have the relate setup that will never produce results.


And Yes you should never be publishing a shapefile for a mapservice, although you can, you just should not. Go ahead and make the change to file geodatabase.
0 Kudos
JimLucht
Emerging Contributor
Hi Robert

Good to have my vague suspicions confirmed! Time to leave shapefiles behind.

Many thanks again for your help and all of your good work.

Take care,

Jim
0 Kudos
JimLucht
Emerging Contributor
Hi Robert

Finally getting back to this again. I went ahead and converted to a file geodatabase that contains just parcels and a deeds table. In a new mxd I have four iterations of the parcel layer defined through a query. I set up a new mapservice based on that, pointed the main config and esearch config there and still only the top layer works. I have tried assigning the relates as all 4, all 0, and 0-3. Only the top layer successfully relates, and only when its relate ID is 0. The relate field is the string-format parcel ID PL.

Any ideas? Are there any other successful examples you can point me to where multiple layers using the same shapefile and relate table (just narrowed down by definition query)?

Here's the viewer:
http://mapper.provplan.org/flexviewers/parcelmapper3/

And the service:
http://mapper.provplan.org/ArcGIS/rest/services/parcel_detail3gdb2/MapServer

Search for Smith. The third one down (92 Priscilla) has two related deeds records.

Many thanks again!

Jim
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jim,

   I have to say that your configuration of using the same layer with different definition queries in ArcMap and then relates all pointing to the same layer is not common and that I have not tested it. I will try to find some time and do some testing on that senario.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jim,

   I have some serious conserns about how you are setting up your relates... Can you explain how you are doing it and what fields you are using?
0 Kudos
JimLucht
Emerging Contributor
Hi Robert

Sorry for the delay in getting back to you- busy weekend! Thanks for taking a look.

The relate part is pretty simple. The file geodatabase contains one parcel layer and one deeds table. The parcel is iterated four times:

Parcel Boundaries
Non Owner-Occ Single and 2-5
Single and 2-5 Family Residential
Apartments (6+ Units) and Mixed Use

These are all defined using a definition query on the [CLASS] field. Each is related to that same Deeds table using [PL] as the relate field. The relates were done in ArcMap, using a different relate name for each one (rel1, rel2, rel3, rel4).

Seems like it should work, but the funny thing is how they appear in the service:
http://mapper.provplan.org/ArcGIS/rest/services/parcel_detail3gdb2/MapServer/0

It shows up as four here:
Relationships:
deeds (0) -- Related To: deeds (4)
deeds (1) -- Related To: deeds (4)
deeds (2) -- Related To: deeds (4)
deeds (3) -- Related To: deeds (4)

And when you look at Deeds it has this:
Relationships:
parcels (0) -- Related To: Parcel Boundaries (0)
parcels (1) -- Related To: Parcel Boundaries (0)
parcels (2) -- Related To: Parcel Boundaries (0)
parcels (3) -- Related To: Parcel Boundaries (0)

Strange that there are four and four, because this is the first layer Parcel Boundaries and it should only have one.

What's weirder is that when you look at the relates for another layer, say Single and 2-5 Family Residential, the relationship to deeds is the same:

Relationships:
deeds (0) -- Related To: deeds (4)
deeds (1) -- Related To: deeds (4)
deeds (2) -- Related To: deeds (4)
deeds (3) -- Related To: deeds (4)

But when you click through on deeds (4) it shows the relationship only to Parcel Boundaries:

Relationships:
parcels (0) -- Related To: Parcel Boundaries (0)
parcels (1) -- Related To: Parcel Boundaries (0)
parcels (2) -- Related To: Parcel Boundaries (0)
parcels (3) -- Related To: Parcel Boundaries (0)

It's like the first relate gets stuck in ArcMap's gullet. Might it be a bug?

The reason I'm setting it up like this is to both make subset layers available (and avoid the need for querying on multiple fields) and to make key data (Deeds) show up universally. Both are pretty essential for the application I'm charged with building.


As always, many thanks for your help!

Jim

/fallback: a service for each layer..?
0 Kudos
DeanSeales
Emerging Contributor
Would either of you be so kind and post the entire code?

I would like to have that solution with two adjustments:
1. Make datagrid appear after query is done.
2. Remove the infowindow

Thank you!
0 Kudos