Select to view content in your preferred language

How to build dynamic SQL based on URL query parameters.

666
0
12-12-2019 06:38 AM
BolekBolek
New Contributor

I have an ArcGIS layer published to my local server at:

          https://baseURL/myMapServer/0

I want to dynamically construct the query where clause for this layer based on the URL. For example:

         https://baseURL/myMapServer/0?category=cat1

would effectively translate into the following:

        where category='cat1'

How can I accomplish this?

The arcgsis documentation touches on the topic:

https://pro.arcgis.com/en/pro-app/help/data/query-layers/update-parameter-values-in-a-query-layer.htm

https://www.esri.com/arcgis-blog/products/sharing-collaboration/sharing-collaboration/using-url-parameters-in-web-apps/

https://developers.arcgis.com/labs/arcgisonline/query-a-feature-layer/


Based on this it seems like it would be possible to pass query parameters like this:

      https://baseURL/myMapServer/0/?query=category=cat1

and then refer to them in the definition query:


     category=::category

But it doesn't work, ArcMap throws an SQL syntax error complaining about ::category.

Tags (1)
0 Kudos
0 Replies