<?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: queryFeaturesResults  undefined in ArcGIS AppStudio Questions</title>
    <link>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1144353#M4170</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/514185"&gt;@TrevorFrame&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I corrected my code as suggested. Unfortunately, I still get this error message : &lt;EM&gt;ReferenceError: result is not defined&lt;/EM&gt;&amp;nbsp; pointing at the line where the While starts. Also, I don't get a return on this&lt;EM&gt; console.log("going through if")&lt;/EM&gt; so it seems the if is skipped.&lt;/P&gt;&lt;P&gt;Other suggestions? Thanks for your help!&lt;/P&gt;&lt;P&gt;MC&lt;/P&gt;</description>
    <pubDate>Tue, 15 Feb 2022 22:36:33 GMT</pubDate>
    <dc:creator>Marie-ClaudeBouchard</dc:creator>
    <dc:date>2022-02-15T22:36:33Z</dc:date>
    <item>
      <title>queryFeaturesResults  undefined</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1143247#M4162</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We are customizing the AppStudio Offline Geocoding and Routing app with our own data. We would like to add the option of selecting the POIs from a combo box so people can select a POI by name if they don't know its location.&lt;/P&gt;&lt;P&gt;The app is build on a mmpk file which includes a locator and a POI layer. The POI layer is the same used to build the locator. We have tried this, but it seems that it doesn't go through the if so the const result in the loop is not defined. How can I fix the problems?&lt;/P&gt;&lt;P&gt;MobileMapPackage {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: mmpk&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; path: AppFramework.resolvedPathUrl(copyLocalData(inputdata, outputdata))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // load the mobile map package&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Component.onCompleted: {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mmpk.load();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // wait for the mobile map package to load&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onLoadStatusChanged: {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (loadStatus === Enums.LoadStatusLoaded) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; // set the map view's map to the first map in the mobile map package&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapView.map = mmpk.maps[0];&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get POITest feature layer and feature table&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const poiLyr = mapView.map.operationalLayers.get(3);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const poiTable = poiLyr.featureTable&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create query parameters object&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; let parameters = ArcGISRuntimeEnvironment.createObject("QueryParameters");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameters.whereClause = "1-1";&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // query table with parameters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; let query = poiTable.queryFeatures(parameters);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get results&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (query.queryFeaturesStatus === Enums.TaskStatusCompleted){;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("going through if");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; const result = queryFeaturesResults[query];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // iterate on results and fill combo box&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; const poiList = [];&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (result.iterator.hasNext()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature = iterator.next();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; poiList.push(feature.attributes.attributeValue("Titre"));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; comboBoxDestination.model = poiList.sort();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 19:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1143247#M4162</guid>
      <dc:creator>Marie-ClaudeBouchard</dc:creator>
      <dc:date>2022-02-11T19:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: queryFeaturesResults  undefined</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1144315#M4169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507409"&gt;@Marie-ClaudeBouchard&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It seems you might be getting undefined because the parameters.whereClause is "1-1" and should be "1=1".&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Trevor&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 21:21:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1144315#M4169</guid>
      <dc:creator>TrevorFrame</dc:creator>
      <dc:date>2022-02-15T21:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: queryFeaturesResults  undefined</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1144353#M4170</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/514185"&gt;@TrevorFrame&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I corrected my code as suggested. Unfortunately, I still get this error message : &lt;EM&gt;ReferenceError: result is not defined&lt;/EM&gt;&amp;nbsp; pointing at the line where the While starts. Also, I don't get a return on this&lt;EM&gt; console.log("going through if")&lt;/EM&gt; so it seems the if is skipped.&lt;/P&gt;&lt;P&gt;Other suggestions? Thanks for your help!&lt;/P&gt;&lt;P&gt;MC&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 22:36:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1144353#M4170</guid>
      <dc:creator>Marie-ClaudeBouchard</dc:creator>
      <dc:date>2022-02-15T22:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: queryFeaturesResults  undefined</title>
      <link>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1155082#M4181</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507409"&gt;@Marie-ClaudeBouchard&lt;/a&gt;&amp;nbsp;sorry I didn't catch your reply sooner. Another thing I noticed is you're declaring the result in the if statement and then trying to access it outside of the if statement, which would cause the ReferenceError: result is not defined.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;As for the if statement being skipped, that's probably due to the query status not being completed yet when being checked. When creating the table on the fly like you did, you should use Connections to setup signal handlers so when the queryFeatureStatus changes, that's when you can iterate through the if statement. Check out this YouTube &lt;A href="https://youtu.be/KeU8DGY0O3A?t=2214" target="_self"&gt;video&lt;/A&gt;&amp;nbsp;to see an example of using Connections.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 23:28:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-appstudio-questions/queryfeaturesresults-undefined/m-p/1155082#M4181</guid>
      <dc:creator>TrevorFrame</dc:creator>
      <dc:date>2022-03-17T23:28:05Z</dc:date>
    </item>
  </channel>
</rss>

