English

Problem: No records returned when using the WHERE attribute in the SPATIALQUERY or QUERY ArcXML tags

Description

No records are returned when querying a shapefile using the WHERE attribute imbedded in the SPATIALQUERY or QUERY XML tags.

For example:

<?xml version="1.0"?>
<ARCXML version="1.0">
<REQUEST>
<GET_FEATURES outputmode="xml" geometry="false" envelope="false" compact="true">
<LAYER id="0" />
<QUERY subfields="#ALL#" where="sfield='Value 1'">
</QUERY>
</GET_FEATURES>
</REQUEST>
</ARCXML>

ArcXML Response:

<?xml version="1.0"?>
<ARCXML version="1.0">
<RESPONSE>
<FEATURES>
<FEATURECOUNT count="0" hasmore="false" />
</FEATURES>
</RESPONSE>
</ARCXML>

Cause

The Spatial Server is unable to process the query because either the shapefile attribute table does not contain an ID field, or the shapefile has an ID field but it is not populated with numeric values.

Solution or Workaround

Make sure the shapefile attribute table contains a number field with the name ID and that the field is populated with unique numeric values. Refer to the article in the Related Information section below for instructions on how to create a new number field and populate it with unique values.

Note:
Refresh the MapService after editing the shapefile.

Related Information