<?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 Getting Rest URL in QueryTask results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578287#M53994</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a config file consisting of multiple rest endpoint urls and various where clauses. This allows the app to query for a value across multiple rest endpoints (can be 1 or as many as 10) with one or more fields (as many as 4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am putting the urls and where clauses in an array and then looping through each, firing off a QueryTask for each:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (q = 0; q &amp;lt; layerIDs.length; q++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var queryTask = new esriQueryTask(layerIDs&lt;Q&gt;);&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var query = new esriQuery();&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.returnGeometry = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.outSpatialReference = {wkid:102100}; &lt;/P&gt;&lt;P&gt;&amp;nbsp; query.outFields = [ '*' ];&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.where = queryWheres&lt;Q&gt;;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; queryTask.execute(query, queryResults, queryError);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the results, I am getting the results.features&lt;I&gt;.geometry and throwing the graphics on the map. All this works well&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var selections = results.features;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array.forEach(selections, function(feat) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; feat.setSymbol(new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, null, new Color([175,0,0,0.50])));&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.graphics.add(feat);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;if (selections.length == 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; smess.set("value", "No results found for the query.");&lt;/P&gt;&lt;P&gt;} else if (selections.length == 1 &amp;amp;&amp;amp; selections[0].geometry.type == "point") { &lt;/P&gt;&lt;P&gt;&amp;nbsp; map.centerAndZoom( selections[0].geometry, 20);&lt;/P&gt;&lt;P&gt;} else { &lt;/P&gt;&lt;P&gt;&amp;nbsp; var extent = GraphicsUtils.graphicsExtent(selections);&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.setExtent(extent.expand(1.25));&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if the results return more than one feature, I put the attributes in a ContentPane within a Container (Tab or Accordion). This I can do but I need to have the title for ContentPane to be something intelligent - preferably the mapserver name. I can use results.displayFieldName but that's nothing useful. I don't see anything in results beyond attributes and geometry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var resPane = new ContentPane({&lt;/P&gt;&lt;P&gt;&amp;nbsp; title: ???results.displayFieldName??? + " (" + results.features.length + ")",&lt;/P&gt;&lt;P&gt;&amp;nbsp; content: grid&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way (without running each QueryTask in a promise and having to hardcode each result) that I can get more information in the results from its QueryTask?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Oct 2015 17:27:40 GMT</pubDate>
    <dc:creator>SteveClark</dc:creator>
    <dc:date>2015-10-13T17:27:40Z</dc:date>
    <item>
      <title>Getting Rest URL in QueryTask results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578287#M53994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a config file consisting of multiple rest endpoint urls and various where clauses. This allows the app to query for a value across multiple rest endpoints (can be 1 or as many as 10) with one or more fields (as many as 4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am putting the urls and where clauses in an array and then looping through each, firing off a QueryTask for each:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (q = 0; q &amp;lt; layerIDs.length; q++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; var queryTask = new esriQueryTask(layerIDs&lt;Q&gt;);&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var query = new esriQuery();&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.returnGeometry = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.outSpatialReference = {wkid:102100}; &lt;/P&gt;&lt;P&gt;&amp;nbsp; query.outFields = [ '*' ];&lt;/P&gt;&lt;P&gt;&amp;nbsp; query.where = queryWheres&lt;Q&gt;;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; queryTask.execute(query, queryResults, queryError);&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the results, I am getting the results.features&lt;I&gt;.geometry and throwing the graphics on the map. All this works well&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var selections = results.features;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array.forEach(selections, function(feat) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; feat.setSymbol(new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, null, new Color([175,0,0,0.50])));&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.graphics.add(feat);&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;if (selections.length == 0) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; smess.set("value", "No results found for the query.");&lt;/P&gt;&lt;P&gt;} else if (selections.length == 1 &amp;amp;&amp;amp; selections[0].geometry.type == "point") { &lt;/P&gt;&lt;P&gt;&amp;nbsp; map.centerAndZoom( selections[0].geometry, 20);&lt;/P&gt;&lt;P&gt;} else { &lt;/P&gt;&lt;P&gt;&amp;nbsp; var extent = GraphicsUtils.graphicsExtent(selections);&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.setExtent(extent.expand(1.25));&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if the results return more than one feature, I put the attributes in a ContentPane within a Container (Tab or Accordion). This I can do but I need to have the title for ContentPane to be something intelligent - preferably the mapserver name. I can use results.displayFieldName but that's nothing useful. I don't see anything in results beyond attributes and geometry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var resPane = new ContentPane({&lt;/P&gt;&lt;P&gt;&amp;nbsp; title: ???results.displayFieldName??? + " (" + results.features.length + ")",&lt;/P&gt;&lt;P&gt;&amp;nbsp; content: grid&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way (without running each QueryTask in a promise and having to hardcode each result) that I can get more information in the results from its QueryTask?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2015 17:27:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578287#M53994</guid>
      <dc:creator>SteveClark</dc:creator>
      <dc:date>2015-10-13T17:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Rest URL in QueryTask results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578288#M53995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Sure all you need to do is to pass the url in your execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;queryTask.execute(query, queryResults, queryError, queryTask.url);

function queryResults(url, results) {
&amp;nbsp;&amp;nbsp; console.info(url);
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578288#M53995</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T00:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Rest URL in QueryTask results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578289#M53996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Robert. I'm just getting into this world and had not known you could pass other parameters. Using an example you stated elsewhere, I came up with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;queryTask.execute(query, lang.hitch(this, queryResults, layerNames&lt;Q&gt;), lang.hitch(this, queryError, queryTask.url));&lt;/Q&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2015 21:37:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-rest-url-in-querytask-results/m-p/578289#M53996</guid>
      <dc:creator>SteveClark</dc:creator>
      <dc:date>2015-10-13T21:37:29Z</dc:date>
    </item>
  </channel>
</rss>

