<?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 Feature table and query results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409750#M37733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wondering if anyone can assist with how to display query results to a feature table? I have searched pretty much everything I can find but just cannot get this to work - I am beginning javascript and I am stumped as to how to get the query results to display in the feature table. I am using the Toolbar function to allow a user to draw a shape and select the features they want. These are the results I want to display. At the moment I can draw a shape and select the features I want and can see that these are returned in the console log but all features in the table are displaying in the table and not the subset. If I use a definition query to subset the layer then only those are displayed. If anyone has any suggestions I would be really grateful. I am using the feature table option as I like the way this handles related tables but happy to adopt other methods such as dgrid if anyone can point me in the right direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some of my code follow - (am using 3.27 api version)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var featureLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services../MapServer/2",{ &lt;BR /&gt; mode: FeatureLayer.MODE_ONDEMAND,&lt;BR /&gt; showRelatedRecords: true,&lt;BR /&gt; //definitionExpression: "objectid in (1176,1184)", &lt;BR /&gt; outFields: ["*"] &lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function initToolbar() { &lt;BR /&gt; tb = new draw(map); &lt;BR /&gt; tb.on("draw-end", addGraphic); &lt;BR /&gt; &lt;BR /&gt; // event delegation so a click handler is not &lt;BR /&gt; // needed for each individual button &lt;BR /&gt; on(dom.byId("info"), "click", function(evt) { &lt;BR /&gt; if ( evt.target.id === "info" ) { &lt;BR /&gt; return; &lt;BR /&gt; } &lt;BR /&gt; var tool = evt.target.id.toLowerCase(); &lt;BR /&gt; map.disableMapNavigation(); &lt;BR /&gt; tb.activate(tool); &lt;BR /&gt; }); &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; function addGraphic(evt) { &lt;BR /&gt; map.graphics.clear(); &lt;BR /&gt; //deactivate the toolbar and clear existing graphics &lt;BR /&gt; tb.deactivate(); &lt;BR /&gt; map.enableMapNavigation(); &lt;BR /&gt; &lt;BR /&gt; // figure out which symbol to use &lt;BR /&gt; var symbol; &lt;BR /&gt; if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") { &lt;BR /&gt; symbol = markerSymbol; &lt;BR /&gt; } else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") { &lt;BR /&gt; symbol = lineSymbol; &lt;BR /&gt; } &lt;BR /&gt; else { &lt;BR /&gt; symbol = fillSymbol; &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; map.graphics.add(new graphic(evt.geometry, symbol)); &lt;BR /&gt; queryMapService(evt.geometry); &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; //working code&lt;BR /&gt; function queryMapService(Geom){ &lt;BR /&gt; var promises = []; &lt;BR /&gt; var featureId = []; &lt;BR /&gt; var query = new Query(); &lt;BR /&gt; query.returnGeometry = false;&lt;BR /&gt; query.objectIds = [featureId];&lt;BR /&gt; //query.where = "1=1";&lt;BR /&gt; query.outFields = ["*"]; &lt;BR /&gt; query.geometry = Geom; &lt;BR /&gt; &lt;BR /&gt; promises.push(featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW)); &lt;BR /&gt; &lt;BR /&gt; var allPromises = new All(promises);&lt;BR /&gt; allPromises.then(function (r) { &lt;BR /&gt; console.log(r);&lt;BR /&gt; //r is an array of stuff&lt;BR /&gt; loadTable(r);&lt;BR /&gt; }); &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; //Array of stuff&lt;BR /&gt; function loadTable(results){ &lt;BR /&gt; var objectIds = objectIds;&lt;BR /&gt; var featureTable = new FeatureTable({&lt;BR /&gt; featureLayer : featureLayer,&lt;BR /&gt; map : map,&lt;BR /&gt; syncSelection: false,&lt;BR /&gt; showRelatedRecords: true,&lt;BR /&gt; showAttachments: true,&lt;BR /&gt; outFields: ["NatName"],&lt;BR /&gt; }, 'myTableNodeSites');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;featureTable.selectedRowIds = objectIds;&lt;BR /&gt; featureTable.filterSelectedRecords(true);&lt;BR /&gt; featureTable.startup(); &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Mar 2019 11:52:25 GMT</pubDate>
    <dc:creator>MarkBalman</dc:creator>
    <dc:date>2019-03-15T11:52:25Z</dc:date>
    <item>
      <title>Feature table and query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409750#M37733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wondering if anyone can assist with how to display query results to a feature table? I have searched pretty much everything I can find but just cannot get this to work - I am beginning javascript and I am stumped as to how to get the query results to display in the feature table. I am using the Toolbar function to allow a user to draw a shape and select the features they want. These are the results I want to display. At the moment I can draw a shape and select the features I want and can see that these are returned in the console log but all features in the table are displaying in the table and not the subset. If I use a definition query to subset the layer then only those are displayed. If anyone has any suggestions I would be really grateful. I am using the feature table option as I like the way this handles related tables but happy to adopt other methods such as dgrid if anyone can point me in the right direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some of my code follow - (am using 3.27 api version)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var featureLayer = new FeatureLayer("http://localhost:6080/arcgis/rest/services../MapServer/2",{ &lt;BR /&gt; mode: FeatureLayer.MODE_ONDEMAND,&lt;BR /&gt; showRelatedRecords: true,&lt;BR /&gt; //definitionExpression: "objectid in (1176,1184)", &lt;BR /&gt; outFields: ["*"] &lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function initToolbar() { &lt;BR /&gt; tb = new draw(map); &lt;BR /&gt; tb.on("draw-end", addGraphic); &lt;BR /&gt; &lt;BR /&gt; // event delegation so a click handler is not &lt;BR /&gt; // needed for each individual button &lt;BR /&gt; on(dom.byId("info"), "click", function(evt) { &lt;BR /&gt; if ( evt.target.id === "info" ) { &lt;BR /&gt; return; &lt;BR /&gt; } &lt;BR /&gt; var tool = evt.target.id.toLowerCase(); &lt;BR /&gt; map.disableMapNavigation(); &lt;BR /&gt; tb.activate(tool); &lt;BR /&gt; }); &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; function addGraphic(evt) { &lt;BR /&gt; map.graphics.clear(); &lt;BR /&gt; //deactivate the toolbar and clear existing graphics &lt;BR /&gt; tb.deactivate(); &lt;BR /&gt; map.enableMapNavigation(); &lt;BR /&gt; &lt;BR /&gt; // figure out which symbol to use &lt;BR /&gt; var symbol; &lt;BR /&gt; if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") { &lt;BR /&gt; symbol = markerSymbol; &lt;BR /&gt; } else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") { &lt;BR /&gt; symbol = lineSymbol; &lt;BR /&gt; } &lt;BR /&gt; else { &lt;BR /&gt; symbol = fillSymbol; &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; map.graphics.add(new graphic(evt.geometry, symbol)); &lt;BR /&gt; queryMapService(evt.geometry); &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; //working code&lt;BR /&gt; function queryMapService(Geom){ &lt;BR /&gt; var promises = []; &lt;BR /&gt; var featureId = []; &lt;BR /&gt; var query = new Query(); &lt;BR /&gt; query.returnGeometry = false;&lt;BR /&gt; query.objectIds = [featureId];&lt;BR /&gt; //query.where = "1=1";&lt;BR /&gt; query.outFields = ["*"]; &lt;BR /&gt; query.geometry = Geom; &lt;BR /&gt; &lt;BR /&gt; promises.push(featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW)); &lt;BR /&gt; &lt;BR /&gt; var allPromises = new All(promises);&lt;BR /&gt; allPromises.then(function (r) { &lt;BR /&gt; console.log(r);&lt;BR /&gt; //r is an array of stuff&lt;BR /&gt; loadTable(r);&lt;BR /&gt; }); &lt;BR /&gt; } &lt;BR /&gt; &lt;BR /&gt; //Array of stuff&lt;BR /&gt; function loadTable(results){ &lt;BR /&gt; var objectIds = objectIds;&lt;BR /&gt; var featureTable = new FeatureTable({&lt;BR /&gt; featureLayer : featureLayer,&lt;BR /&gt; map : map,&lt;BR /&gt; syncSelection: false,&lt;BR /&gt; showRelatedRecords: true,&lt;BR /&gt; showAttachments: true,&lt;BR /&gt; outFields: ["NatName"],&lt;BR /&gt; }, 'myTableNodeSites');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;featureTable.selectedRowIds = objectIds;&lt;BR /&gt; featureTable.filterSelectedRecords(true);&lt;BR /&gt; featureTable.startup(); &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 11:52:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409750#M37733</guid>
      <dc:creator>MarkBalman</dc:creator>
      <dc:date>2019-03-15T11:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Feature table and query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409751#M37734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Have you seen this dGrid sample?&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/3/jssamples/fl_dgrid.html" title="https://developers.arcgis.com/javascript/3/jssamples/fl_dgrid.html"&gt;dgrid | ArcGIS API for JavaScript 3.27&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Mar 2019 13:20:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409751#M37734</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-03-15T13:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Feature table and query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409752#M37735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for this, as much as I have looked at pretty much all the examples I cannot seem to find anything to help me work out how to return the results of a query (user defined shape) and put these into a table that also shows related records. Lack of knowledge on my behalf but slowly getting there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2019 15:47:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-table-and-query-results/m-p/409752#M37735</guid>
      <dc:creator>MarkBalman</dc:creator>
      <dc:date>2019-03-18T15:47:14Z</dc:date>
    </item>
  </channel>
</rss>

