Select to view content in your preferred language

Accessing Related Records with the Enhanced Search Widget

2296
15
Jump to solution
09-06-2012 06:00 AM
MichaelVolz
Esteemed Contributor
I am creating a FlexViewer application using the Enhanced Search Widget and I cannot get the related records to appear in the application or the REST service.  How would I get access to these records?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Do you have the relates tag setup in your eSearchWidget.xml as documented?

Example (from the eSearchWidget.xml that comes with the download).
            <relates>                 <relate id="3" label="Signs" enableexport="false" icon="assets/images/i_lego.png">                     <fields all="false">                         <field name="Type" />                         <field name="Road_ID" />                         <field name="Condition" />                         <field name="P_Hyper" />                         <field name="Image_" hyperlinkgridfield="true" hyperlinkgridicon="assets/images/i_lego.png"                             hyperlinkaliastext="Get Sign Image" linkprefix="" linksuffix="" />                         <field name="post" />                     </fields>                 </relate>                 <relate id="4" label="Guardrails" enableexport="true" icon="assets/images/i_clock.png">                     <fields all="false">                         <field name="Type" />                         <field name="ID" />                         <field name="Date_P" dateformat="MM/DD/YYYY" />                         <field name="Date_R" dateformat="MM/DD/YYYY" />                         <field name="Type_end_a" />                         <field name="Type_start_a" />                         <field name="Comments" />                     </fields>                 </relate>             </relates>

View solution in original post

0 Kudos
15 Replies
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Do you have the relates tag setup in your eSearchWidget.xml as documented?

Example (from the eSearchWidget.xml that comes with the download).
            <relates>                 <relate id="3" label="Signs" enableexport="false" icon="assets/images/i_lego.png">                     <fields all="false">                         <field name="Type" />                         <field name="Road_ID" />                         <field name="Condition" />                         <field name="P_Hyper" />                         <field name="Image_" hyperlinkgridfield="true" hyperlinkgridicon="assets/images/i_lego.png"                             hyperlinkaliastext="Get Sign Image" linkprefix="" linksuffix="" />                         <field name="post" />                     </fields>                 </relate>                 <relate id="4" label="Guardrails" enableexport="true" icon="assets/images/i_clock.png">                     <fields all="false">                         <field name="Type" />                         <field name="ID" />                         <field name="Date_P" dateformat="MM/DD/YYYY" />                         <field name="Date_R" dateformat="MM/DD/YYYY" />                         <field name="Type_end_a" />                         <field name="Type_start_a" />                         <field name="Comments" />                     </fields>                 </relate>             </relates>
0 Kudos
MichaelVolz
Esteemed Contributor
I was getting mixed up with the indices that should be used.  The REST service gave the relate an index of 2 so I put that in for the relate ID and no related records were returned.  When I changed the relate ID to 0, I was able to get related records.
0 Kudos
MichaelVolz
Esteemed Contributor
Can the expression for the query be linked to the related records?  It seems like all the samples are linked to the primary feature class or standalone table for each mapservice.

If this can be done, what would the proper syntax be?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Relate are delivered as a "one to one" or "one to many" relationship with the search record that you click on, so I am lost as to what your question is...
0 Kudos
MichaelVolz
Esteemed Contributor
Here is a query that I would like to perform against a mapservice representing parcels:

<expression alias="Parcels - Owner" textsearchlabel="Search Parcels by Owner...">
      <values>
          <value prompt="Example: Smith John" isvaluerequired="true">upper(OWN1) LIKE upper('%[value]%')</value>
      </values>
                </expression>

The OWN1 field is not part of the feature class, but is found in the related table.  I want to be able to perform the query for the OWN1 field with this syntax but I get the following error message:

[RPC Fault faultString="Unable to complete operation." faultCode="400" faultDetail="Unable to complete Query operation."]
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Relates are very different than joins and because a relate is not actually added to the data there is now way to query for a relate field and an actual data field.
0 Kudos
MichaelVolz
Esteemed Contributor
So would need to somehow get the field that is in the related record added to the primary feature class.  There would be duplication of data, but that would be the only way to accomplish this task.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Am I some how out of touch and you can now query in ArcMap for a layer and include a related layers field in the same query...
0 Kudos
MichaelVolz
Esteemed Contributor
You are definitely not out of touch, as I never had the business need to perform this operation in ArcMap, just in a FlexViewer web application.  Now that I know it can not be done I will find an alternate method.  Thanks for the information, though
0 Kudos