<?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: determine name of feature layer queried from promise.allSettled list in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417630#M84474</link>
    <description>&lt;P&gt;Excellent suggestion! I was looking for that. I'm marking it as the solution.&lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2024 16:31:12 GMT</pubDate>
    <dc:creator>DanielScholes</dc:creator>
    <dc:date>2024-05-01T16:31:12Z</dc:date>
    <item>
      <title>determine name of feature layer queried from promise.allSettled list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417170#M84459</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;I have a set of feature layers that I am querying through an array&amp;nbsp; of queryFeatures. When the queries and run through a Promise.AllSettled, I can loop through the results. I am trying to determine the feature layer id of each set of results. I am having trouble finding an exposed id value. I will summarize an example below. Again, I want to determine which feature layer ID of each result set.&lt;/P&gt;&lt;P&gt;Thank you for looking at this.&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;P&gt;const parcelQuery = {&lt;BR /&gt;spatialRelationship: "intersects", // Relationship operation to apply&lt;BR /&gt;geometry: queryExtent, // The sketch feature geometry&lt;BR /&gt;outFields: ["TheObjectId"], // Attributes to return&lt;BR /&gt;returnGeometry: true&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var promiseArray = [];&lt;/P&gt;&lt;P&gt;//featureLayerArray is an array of the possible feature layers, but we only want to query the ones that are checked with a checkbox&lt;/P&gt;&lt;P&gt;for (const tempFeatureLayer of featureLayerArray) {&lt;/P&gt;&lt;P&gt;tempCheckbox = tempFeatureLayer.id.toString().replace('flqT', 'l');&lt;BR /&gt;&lt;BR /&gt;if (document.getElementById(tempCheckbox).checked) // layer is selected&lt;BR /&gt;{&lt;BR /&gt;//example definition&lt;BR /&gt;tempFeatureLayer.definitionExpression = "UTCstart &amp;gt;= '2020-01' and UTCstart &amp;lt;= '2023-06z'";&lt;BR /&gt;promiseArray.push(tempFeatureLayer.queryFeatures(parcelQuery));&lt;BR /&gt;console.log('pushed query to array for (tempFeatureLayer.id): ' + tempFeatureLayer.id);&amp;nbsp; // the ID displays correctly&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Promise.allSettled(promiseArray).then((results) =&amp;gt;&lt;BR /&gt;results.forEach((result) =&amp;gt; {&lt;BR /&gt;console.log('result');&lt;BR /&gt;console.log('resultID: ' + result.id);&amp;nbsp; // undefined&lt;BR /&gt;console.log('result.value.title: ' + result.value.title); //undefined&lt;BR /&gt;console.log('result.value.id: ' + result.value.id); //undefined&lt;BR /&gt;console.log("result.status: " + result.status); //returns value&lt;BR /&gt;console.log('exceededTransferLimit: ' + result.value.exceededTransferLimit.toString()); //returns value&lt;/P&gt;&lt;P&gt;if (result.value.features.length &amp;gt; 0) {&lt;BR /&gt;console.log('------ features --------');&lt;BR /&gt;const featureList = result.value.features;&lt;BR /&gt;for (let i = 0; i &amp;lt; featureList.length; i++) {&lt;BR /&gt;console.log('i: ' + i.toString());&lt;BR /&gt;console.log(featureList[i].attributes.TheObjectId);&lt;BR /&gt;}&lt;BR /&gt;console.log('------ end of features --------');&lt;BR /&gt;}&lt;BR /&gt;})&lt;BR /&gt;).catch(error =&amp;gt; {&lt;BR /&gt;console.log('There is an Error!');&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 17:51:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417170#M84459</guid>
      <dc:creator>DanielScholes</dc:creator>
      <dc:date>2024-04-30T17:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: determine name of feature layer queried from promise.allSettled list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417245#M84462</link>
      <description>&lt;P&gt;It looks like the Promise.allSettled returns the results in the same order as submitted, so I can make a parallel array of what is submitted and loop that array at the same time I'm reading the results. I'm still open to knowing if there is a way to pull the featurelayer id from the results, though. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 20:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417245#M84462</guid>
      <dc:creator>DanielScholes</dc:creator>
      <dc:date>2024-04-30T20:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: determine name of feature layer queried from promise.allSettled list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417313#M84465</link>
      <description>&lt;P&gt;You can also get the layer ID for any result that returns at least one feature by looking at the first feature's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer" target="_self"&gt;layer&lt;/A&gt; property, and subsequently the layer's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#id" target="_self"&gt;id&lt;/A&gt; property:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (result.value.features.length &amp;gt; 0) {
    var layerID = result.value.features[0].layer.id;
    //etc
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 23:14:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417313#M84465</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-04-30T23:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: determine name of feature layer queried from promise.allSettled list</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417630#M84474</link>
      <description>&lt;P&gt;Excellent suggestion! I was looking for that. I'm marking it as the solution.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 16:31:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/determine-name-of-feature-layer-queried-from/m-p/1417630#M84474</guid>
      <dc:creator>DanielScholes</dc:creator>
      <dc:date>2024-05-01T16:31:12Z</dc:date>
    </item>
  </channel>
</rss>

