<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: query related records attributes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529056#M49378</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;TO my understanding, there is no single WHERE clause you can apply to accomplish what you want. You might end up with two queries: first to filter the related table based on its where clause; once returned, use its result to query the feature layer based on the related record ids and the where clause for the feature layer. Then you can process the result the way you like. Don't try to query the feature layer first; otherwise, you will end up with more queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;require([ &amp;nbsp; "esri/tasks/Query", "esri/tasks/QueryTask", "esri/tasks/RelationshipQuery"&amp;nbsp; ], function(Query, QueryTask, RelationshipQuery) { &amp;nbsp; var queryTask = new QueryTask("related data url");&amp;nbsp; &amp;nbsp; var query = new Query(); &amp;nbsp; query.where = "where clause to filter the related data";&amp;nbsp;&amp;nbsp; &amp;nbsp; queryTask.executeForIds(query,function(relDataIds){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var relQuery = new RelationshipQuery(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.definitionExpression = "where clause to filter the feature"; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.objectIds = relDataIds; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.relationshipId = 3; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.returnGeometry = true; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.executeRelationshipQuery(relQuery, function(featureSet) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do whatever you like to process the final result &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &amp;nbsp; }); });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Aug 2013 19:26:22 GMT</pubDate>
    <dc:creator>JasonZou</dc:creator>
    <dc:date>2013-08-27T19:26:22Z</dc:date>
    <item>
      <title>query related records attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529055#M49377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to extend a query to the attributes of a related table?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a bunch of drop down menus designed to let users filter out my map layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to execute a query that on completion highlights features that satisfy a particular 'where' clause AND whose related record also satisfies a 'where' clause&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Joining is the easiest thing to do, but I can't join because of a bug that affects the naming conventions of attributes in published map services. So I'm left with relates&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 18:55:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529055#M49377</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-08-27T18:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: query related records attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529056#M49378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;TO my understanding, there is no single WHERE clause you can apply to accomplish what you want. You might end up with two queries: first to filter the related table based on its where clause; once returned, use its result to query the feature layer based on the related record ids and the where clause for the feature layer. Then you can process the result the way you like. Don't try to query the feature layer first; otherwise, you will end up with more queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;require([ &amp;nbsp; "esri/tasks/Query", "esri/tasks/QueryTask", "esri/tasks/RelationshipQuery"&amp;nbsp; ], function(Query, QueryTask, RelationshipQuery) { &amp;nbsp; var queryTask = new QueryTask("related data url");&amp;nbsp; &amp;nbsp; var query = new Query(); &amp;nbsp; query.where = "where clause to filter the related data";&amp;nbsp;&amp;nbsp; &amp;nbsp; queryTask.executeForIds(query,function(relDataIds){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var relQuery = new RelationshipQuery(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.definitionExpression = "where clause to filter the feature"; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.objectIds = relDataIds; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.relationshipId = 3; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relQuery.returnGeometry = true; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.executeRelationshipQuery(relQuery, function(featureSet) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do whatever you like to process the final result &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); &amp;nbsp; }); });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 19:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529056#M49378</guid>
      <dc:creator>JasonZou</dc:creator>
      <dc:date>2013-08-27T19:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: query related records attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529057#M49379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, this approach is working for me. In my case where there are two layers being queried, I must first do a relationship query against layer 1 to retrieve the related records that meet my 'where' criteria, and then with the results do a second relationship query against layer 2. The results of the second relationship query are assigned graphic properties and added to the map&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 20:22:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-related-records-attributes/m-p/529057#M49379</guid>
      <dc:creator>KaitlynnDavis</dc:creator>
      <dc:date>2013-08-27T20:22:01Z</dc:date>
    </item>
  </channel>
</rss>

