Search code examples
jsonarcgisarcgis-js-api

JSON Queries - Failed to execute


So, I am trying to execute a query using ArcGIS API, but it should match any Json queries. I am kind of new to this query format, so I am pretty sure I must be missing something, but I can't figure out what it is.

This page allows for testing queries on the database before I actually implement them in my code. Features in this database have several fields, including OBJECTID and Identificatie. I would like to, for example, select the feature where Identificatie = 1. If I enter this in the Where field though (Identificatie = 1) an error Failed to execute appears. This happens for every field, except for OBJECTID. Querying where OBJECTID = 1 returns the correct results. I am obviously doing something wrong, but I don't get it why OBJECTID does work here. A brief explanation (or a link to a page documenting queries for JSON, which I haven't found), would be appreciated!


Solution

  • Identificatie, along with most other fields in the service you're using, is a string field. Therefore, you need to use single quotes in your WHERE clause:

    Identificatie = '1'
    

    Or to get one that actually exists:

    Identificatie = '1714100000729432'
    

    OBJECTID = 1 works without quotes because it's a numeric field.

    Here's a link to the correct query. And here's a link to the query with all output fields included.