Select to view content in your preferred language

Error at simple QueryTask on large map service layer

1077
5
Jump to solution
11-10-2016 05:37 PM
PitersonPaulgek
Deactivated User

Hi, we try to run simple QueryTask on large (1.5 million features) map service layer:

var queryTask = new QueryTask("someURL/arcgis/rest/services/Polygons2/MapServer/0");

var query = new Query();
query.returnGeometry = true;
query.outFields = ["Name1,Name2"];


query.where = "SomeID = 12345";
queryTask.execute(query, _showResults, _displayError);

_showResults = function (features) {
selectedGraphics.clear();

for (var i = 0; i < features.length; i++) {
var feature = features;
feature.symbol = HighlightSymbol;
selectedGraphics.add(feature);
}

_displayError = function (error) {
console.log(error);
alert("Error");
};

We have the error:

Error: Failed to execute query.
at Object.g.load (https://js.arcgis.com/3.17/init.js:857:426)
at https://js.arcgis.com/3.17/init.js:87:450
at c (https://js.arcgis.com/3.17/init.js:103:393)
at d (https://js.arcgis.com/3.17/init.js:103:182)
at b.Deferred.resolve.callback (https://js.arcgis.com/3.17/init.js:105:10)
at c (https://js.arcgis.com/3.17/init.js:104:96)
at d (https://js.arcgis.com/3.17/init.js:103:182)
at b.Deferred.resolve.callback (https://js.arcgis.com/3.17/init.js:105:10)
at https://js.arcgis.com/3.17/init.js:92:118
at h (https://js.arcgis.com/3.17/init.js:107:279)

Please help to understand/fix the error.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

First thing I would do is verify that your query works just using the rest end point for the map service.

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Emeritus

First thing I would do is verify that your query works just using the rest end point for the map service.

PitersonPaulgek
Deactivated User

Robert, thank you.

I did.
Seems to be syntax error in the query.where.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Is the field you are querying a string or numeric?

0 Kudos
PitersonPaulgek
Deactivated User

It is string.

The solution:

query.where = "SomeID = '12345'";

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Great.

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

0 Kudos