<?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 How to build dynamic SQL based on URL query parameters. in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-build-dynamic-sql-based-on-url-query/m-p/202154#M985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an ArcGIS layer published to my local server at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;A href="https://baseURL/myMapServer/0"&gt;https://baseURL/myMapServer/0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to dynamically construct the query where clause for this layer based on the URL. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;A href="https://baseURL/myMapServer/0?category=cat1"&gt;https://baseURL/myMapServer/0?category=cat1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would effectively translate into the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where category='cat1'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I accomplish this?&lt;/P&gt;&lt;P&gt;The arcgsis documentation touches on the topic:&lt;/P&gt;&lt;P&gt;https://pro.arcgis.com/en/pro-app/help/data/query-layers/update-parameter-values-in-a-query-layer.htm&lt;/P&gt;&lt;P&gt;https://www.esri.com/arcgis-blog/products/sharing-collaboration/sharing-collaboration/using-url-parameters-in-web-apps/&lt;/P&gt;&lt;P&gt;https://developers.arcgis.com/labs/arcgisonline/query-a-feature-layer/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Based on this it seems like it would be possible to pass query parameters like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;A href="https://baseURL/myMapServer/0/?query=category=cat1"&gt;https://baseURL/myMapServer/0/?query=category=cat1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then refer to them in the definition query:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;category=::category&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it doesn't work, ArcMap throws an SQL syntax error complaining about ::category.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Dec 2019 14:38:06 GMT</pubDate>
    <dc:creator>BolekBolek</dc:creator>
    <dc:date>2019-12-12T14:38:06Z</dc:date>
    <item>
      <title>How to build dynamic SQL based on URL query parameters.</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-build-dynamic-sql-based-on-url-query/m-p/202154#M985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an ArcGIS layer published to my local server at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;A href="https://baseURL/myMapServer/0"&gt;https://baseURL/myMapServer/0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to dynamically construct the query where clause for this layer based on the URL. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;A href="https://baseURL/myMapServer/0?category=cat1"&gt;https://baseURL/myMapServer/0?category=cat1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would effectively translate into the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where category='cat1'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I accomplish this?&lt;/P&gt;&lt;P&gt;The arcgsis documentation touches on the topic:&lt;/P&gt;&lt;P&gt;https://pro.arcgis.com/en/pro-app/help/data/query-layers/update-parameter-values-in-a-query-layer.htm&lt;/P&gt;&lt;P&gt;https://www.esri.com/arcgis-blog/products/sharing-collaboration/sharing-collaboration/using-url-parameters-in-web-apps/&lt;/P&gt;&lt;P&gt;https://developers.arcgis.com/labs/arcgisonline/query-a-feature-layer/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Based on this it seems like it would be possible to pass query parameters like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;A href="https://baseURL/myMapServer/0/?query=category=cat1"&gt;https://baseURL/myMapServer/0/?query=category=cat1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then refer to them in the definition query:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;category=::category&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it doesn't work, ArcMap throws an SQL syntax error complaining about ::category.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Dec 2019 14:38:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/how-to-build-dynamic-sql-based-on-url-query/m-p/202154#M985</guid>
      <dc:creator>BolekBolek</dc:creator>
      <dc:date>2019-12-12T14:38:06Z</dc:date>
    </item>
  </channel>
</rss>

