<?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: Trying to query a datasource is a custom widget, never returns any results in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254667#M6177</link>
    <description>&lt;P&gt;Thanks for the help Grant.&amp;nbsp; &amp;nbsp;I used that exact code and set a breakpoint to debug the steps.&amp;nbsp; &amp;nbsp;When I stepped thru the ds.query, it blew right past all the statements and went to the end of my function.&amp;nbsp; &amp;nbsp;When I examine the "ds" properties in developer tools, everything looks fine.&amp;nbsp; &amp;nbsp;URL, schema, etc.&amp;nbsp; &amp;nbsp;I verified that data does indeed exist in the layer.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll keep at it.&amp;nbsp; &amp;nbsp;I know it's something on my end and it's been a while since I've done much development.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 22:46:23 GMT</pubDate>
    <dc:creator>PaulNRWA</dc:creator>
    <dc:date>2023-02-02T22:46:23Z</dc:date>
    <item>
      <title>Trying to query a datasource is a custom widget, never returns any results</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254576#M6174</link>
      <description>&lt;P&gt;I'm attempting to create a custom widget and struggling to query data from a feature layer.&amp;nbsp; When I step thru the debugger, everything works, but no data rows are ever returned.&amp;nbsp; &amp;nbsp;The debugger shows the DataSource does indeed exist and everything looks fine, I simply cannot get any data to return.&amp;nbsp; &amp;nbsp;Here is a stripped down version of the code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;let&lt;/SPAN&gt; &lt;SPAN&gt;qryParamsNow&lt;/SPAN&gt;&lt;SPAN&gt; = [] &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;SqlQueryParams&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;qryParamsNow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;where&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'1=1'&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;qryParamsNow&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;outFields&lt;/SPAN&gt;&lt;SPAN&gt; = [&lt;/SPAN&gt;&lt;SPAN&gt;'*'&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;let&lt;/SPAN&gt; &lt;SPAN&gt;dataPortalUser&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DataSourceManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getInstance&lt;/SPAN&gt;&lt;SPAN&gt;().&lt;/SPAN&gt;&lt;SPAN&gt;getDataSourcesAsArray&lt;/SPAN&gt;&lt;SPAN&gt;()[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;QueriableDataSource&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;dataPortalUser&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;query&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;qryParamsNow&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;SPAN&gt;((&lt;/SPAN&gt;&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;=&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;record&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;response&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;records&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;];&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;record&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getFieldValue&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'email'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;finally&lt;/SPAN&gt;&lt;SPAN&gt;() &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;// Any records?&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;dtrResults&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;dataPortalUser&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getRecords&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;console&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;dtrResults&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;].&lt;/SPAN&gt;&lt;SPAN&gt;getFieldValue&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'email'&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;As I step thru the debugger, I keep an eye on the network and that layer is never accessed.&amp;nbsp; &amp;nbsp;When it reaches the '.finally' the message shows unloaded.&amp;nbsp; &amp;nbsp;Prior to that the response message is 'pending'.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Feb 2023 20:41:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254576#M6174</guid>
      <dc:creator>PaulNRWA</dc:creator>
      <dc:date>2023-02-02T20:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to query a datasource is a custom widget, never returns any results</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254635#M6176</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;Not sure about casting to QueriableDataSource (I've not used it in my workflows), I cast to a FeatureLayerDataSource and then query from there. The other recommendation I would make is to always include a catch in your promises, as it will allow you to see any errors generated from the server, otherwise they can fail silently. See code snippet below&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let dsm = DataSourceManager.getInstance();
        // use the settings to get the datasource by id.
        let ds = dsm.getDataSource(this.props.useDataSources[1].dataSourceId) as FeatureLayerDataSource;  
        //I'm not creating a seperate object for query parameters, just passing them in like so
        ds.query({ where: '1 = 1', returnGeometry: false, pageSize: 2 })
            .then((response) =&amp;gt;
            {
                //Log the respone
                console.log(response)
            })
            .catch((error) =&amp;gt; {
                //Catch any issues and log to the console
                console.error(error)
            })
            .finally(() =&amp;gt; {
                console.log('Operation completed')
            })&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this helps.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 21:53:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254635#M6176</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2023-02-02T21:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to query a datasource is a custom widget, never returns any results</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254667#M6177</link>
      <description>&lt;P&gt;Thanks for the help Grant.&amp;nbsp; &amp;nbsp;I used that exact code and set a breakpoint to debug the steps.&amp;nbsp; &amp;nbsp;When I stepped thru the ds.query, it blew right past all the statements and went to the end of my function.&amp;nbsp; &amp;nbsp;When I examine the "ds" properties in developer tools, everything looks fine.&amp;nbsp; &amp;nbsp;URL, schema, etc.&amp;nbsp; &amp;nbsp;I verified that data does indeed exist in the layer.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'll keep at it.&amp;nbsp; &amp;nbsp;I know it's something on my end and it's been a while since I've done much development.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 22:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254667#M6177</guid>
      <dc:creator>PaulNRWA</dc:creator>
      <dc:date>2023-02-02T22:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to query a datasource is a custom widget, never returns any results</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254674#M6178</link>
      <description>&lt;P&gt;Hi Paul&lt;/P&gt;&lt;P&gt;Unless you set a break point on the return statements, eg console.log etc, it will pass over it as its an async process, so it will run the code in the background after which it will jump in to either the then/catch functions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try that and see if you start to see any results?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 22:52:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254674#M6178</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2023-02-02T22:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to query a datasource is a custom widget, never returns any results</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254801#M6180</link>
      <description>&lt;P&gt;Grant - thank you so much!&amp;nbsp; I had async in the back of my head, but was too impatient.&amp;nbsp; &amp;nbsp;All is now working and I can move on.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate the help.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 12:51:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/trying-to-query-a-datasource-is-a-custom-widget/m-p/1254801#M6180</guid>
      <dc:creator>PaulNRWA</dc:creator>
      <dc:date>2023-02-03T12:51:07Z</dc:date>
    </item>
  </channel>
</rss>

