I might classify this thread as a bug report. The scenario is described below:
I created a JS application that does query on a MapService layer. In the debugging, I got the value of the query.where clause. If I post this clause into the MapService layer's Where textbox, and then click the Query button, I can get respected results (e.g. a couple of dozens of records, which are the same as that in ArcMap's definition-query on the map layer in the map document). This query clause is VERY long. In my JS application, I put a break-point in function showResults(). If the query clause is NOT too long, the code goes through smoothly. However, if the clause is Too Long, it goes through without any break. I would guess there is may be a bug in the API that may limits the length of whereClause. If you have similar experience like that, please share Thanks for your attention.
queryTask.execute(query, showResults);
...
function showResults(result) {
var items = [];
for (var i = 0, il = result.features.length; i < il; i++) {
items.push(result.features.attributes);
}
...
}
If your request is longer than 2048 characters, you'll need to use a proxy.
Ken: Thanks for your point. I added a couple lines of code, but it still does not work. The code I added are listed below:
dojo.require("esri.urlUtils"); // for proxy
...
In function init(), added:
esriConfig.defaults.io.proxyUrl = _proxyURL;
esriConfig.defaults.io.alwaysUseProxy = false;
Did I miss anything else? Thanks if you can further point it out.