AnsweredAssumed Answered

ArcGIS 10.4 QueryTask outfields issue

Question asked by clmoten84 on Oct 20, 2017
Latest reply on Oct 20, 2017 by kenbuja

Hello,

 

I am experiencing a strange issue with the outfields attribute of the Query class in the JS API. So I have a 10.4.1 ArcGIS server instance with a published map service running. The map service data source is an SDE instance backed by SQL Server. I am trying to query this map service to retrieve all the distinct values for a particular field. So my query looks like the following:

 

var query = new esri.tasks.Query();

query.returnGeometry = false;

query.returnDistinctValues = true;

query.outFields = [<field-name-is-too-long-I-guess>];

query.where = "OBJECTID >= 0";

 

The field name that I am querying in the outFields attribute is about 25 characters long. When I attempt to execute this query with an esri.tasks.QueryTask instance, the query fails because the field name in outFields is being truncated to 22 characters before it gets to the database. So the field name being queried in the database becomes 'field-name-is-too-long' instead of 'field-name-is-too-long-I-guess'. This causes SQL Server to error because that column does not exist in my DB table.

 

So has anybody seen this behavior, where the outfield name is truncated before the query makes it to the underlying database? Strangely, this doesn't happen in ArcGIS 10.2.1. I have the exact same setup with the same column names in a 10.2.1 environment and the outfield field name truncation does not occur. Does anyone know if there is a setting or configuration on my 10.4.1 ArcGIS Server or map service that controls field name size limits for queries?

 

P.S.

I get the same truncation behavior when I try to execute the query directly from the map service REST endpoint page as well. For some reason, 10.4.1 ArcGIS is not liking my field names that are longer than 22 characters...at least when it comes to querying on them...???

 

Any help would be greatly appreciated

Outcomes