<?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: DataSourceComponent Spatial Query in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1023448#M1465</link>
    <description>&lt;P&gt;Dave,&lt;/P&gt;&lt;P&gt;I'm responding 3 weeks after your post, so you may have solved this. If not, I'm using this solution my colleague wrote up:&amp;nbsp;&lt;A href="https://github.com/fabanc/esri-canada-uc-experience-builder-widgets/tree/master/working-with-feature-layers/step-4-plugging-triggers" target="_blank"&gt;https://github.com/fabanc/esri-canada-uc-experience-builder-widgets/tree/master/working-with-feature-layers/step-4-plugging-triggers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can see in the code that within the DataSourceComponent calls query. Inside query is a reference to the map extent state (which is getting updated from the message/trigger). If you want to do your own geometry, well, the code shows how it's being passed into the return definition.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;query = () =&amp;gt; {
  if (!this.isDsConfigured()) {
    return;
  }
  
  let where = '1=1';
  let outFields =  ['*'];
  let geometry = (this.props.stateProps &amp;amp;&amp;amp; this.props.stateProps.EXTENT_CHANGE) ? this.props.stateProps.EXTENT_CHANGE: null
  
  return {
    where: '1=1',
    outFields: outFields,
    geometry: geometry
  }
}


        &amp;lt;DataSourceComponent query={query} widgetId={this.props.id} useDataSource={useDataSources[0]} onDataSourceCreated={this.onDs}&amp;gt;
        {this.renderCount.bind(this)}
        &amp;lt;/DataSourceComponent&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 15:58:04 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-02-04T15:58:04Z</dc:date>
    <item>
      <title>DataSourceComponent Spatial Query</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1017314#M1403</link>
      <description>&lt;P&gt;While using the sample widget named feature-layer (&lt;A href="https://developers.arcgis.com/experience-builder/sample-code/widgets/feature-layer-class/" target="_self"&gt;https://developers.arcgis.com/experience-builder/sample-code/widgets/feature-layer-class/&lt;/A&gt;) I notice that&amp;nbsp;FeatureLayerQueryParams has a geometry property.&amp;nbsp; I have been importing JSAPI modules to do spatial queries and I thought I would switch to DataSourceComponent instead.&amp;nbsp; I tried setting the property to an envelope, but it didn't work.&amp;nbsp; The geometry parameter in the URL to the REST endpoint looked, like this:&lt;/P&gt;&lt;P&gt;geometry=%7B%7D&lt;/P&gt;&lt;P&gt;instead of this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;geometry=%7Bxmin%3A+2254552%2C+ymin%3A+250692%2C+xmax%3A+2254562%2C+ymax%3A+250702%7D&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/3952iA6AE4A5B0ECDDFB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is it possible to use DataSourceComponent for spatial queries?&amp;nbsp; Is there some other component I should be using?&lt;/P&gt;&lt;P&gt;See:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/experience-builder/api-reference/jimu-core/FeatureLayerQueryParams" target="_self"&gt;FeatureLayerQueryParams Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 18:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1017314#M1403</guid>
      <dc:creator>DaveFullerton</dc:creator>
      <dc:date>2021-01-15T18:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: DataSourceComponent Spatial Query</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1023448#M1465</link>
      <description>&lt;P&gt;Dave,&lt;/P&gt;&lt;P&gt;I'm responding 3 weeks after your post, so you may have solved this. If not, I'm using this solution my colleague wrote up:&amp;nbsp;&lt;A href="https://github.com/fabanc/esri-canada-uc-experience-builder-widgets/tree/master/working-with-feature-layers/step-4-plugging-triggers" target="_blank"&gt;https://github.com/fabanc/esri-canada-uc-experience-builder-widgets/tree/master/working-with-feature-layers/step-4-plugging-triggers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can see in the code that within the DataSourceComponent calls query. Inside query is a reference to the map extent state (which is getting updated from the message/trigger). If you want to do your own geometry, well, the code shows how it's being passed into the return definition.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;query = () =&amp;gt; {
  if (!this.isDsConfigured()) {
    return;
  }
  
  let where = '1=1';
  let outFields =  ['*'];
  let geometry = (this.props.stateProps &amp;amp;&amp;amp; this.props.stateProps.EXTENT_CHANGE) ? this.props.stateProps.EXTENT_CHANGE: null
  
  return {
    where: '1=1',
    outFields: outFields,
    geometry: geometry
  }
}


        &amp;lt;DataSourceComponent query={query} widgetId={this.props.id} useDataSource={useDataSources[0]} onDataSourceCreated={this.onDs}&amp;gt;
        {this.renderCount.bind(this)}
        &amp;lt;/DataSourceComponent&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 15:58:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1023448#M1465</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-04T15:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: DataSourceComponent Spatial Query</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1055746#M1901</link>
      <description>&lt;P&gt;With help from&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/172234"&gt;@ShawnGoulet&lt;/a&gt;,&amp;nbsp;the answer is to convert to JSON to set the extent:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;geometry:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.state.jimuMapView?.view?.extent?.toJSON()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DaveFullerton_0-1620406748892.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/12831i9CAFA16A63B2B880/image-size/large?v=v2&amp;amp;px=999" role="button" title="DaveFullerton_0-1620406748892.png" alt="DaveFullerton_0-1620406748892.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 07 May 2021 17:00:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/datasourcecomponent-spatial-query/m-p/1055746#M1901</guid>
      <dc:creator>DaveFullerton</dc:creator>
      <dc:date>2021-05-07T17:00:52Z</dc:date>
    </item>
  </channel>
</rss>

