This was working for over a week and now all of a sudden I am getting the following error:Error {code: 400, message: "Failed to execute query.", details: Array[0], log: undefined, httpCode: 400???} I am just calling a simple query...the query actually works and filters out the proper data but it never makes it inside my showResults function...the code is below including where it is failing:var myQuery,
myQueryTask;
myQueryTask = new QueryTask(railLocationsURL + "/0");
myQuery = new Query();
myQuery.returnGeometry = true;
myQuery.outFields = ["QUALIFICAT","NAME","GECFACILIT","CITY"];
function execute() {
var shopName = dojo.byId('shopName').value;
myQuery.where = "NAME IN ('" + shopName + "')";
myQueryTask.execute(myQuery, showResults);
filter();
}
//create symbol for selected features
// symbol = new SimpleMarkerSymbol();
// symbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE);
// symbol.setSize(10);
// symbol.setColor(new Color([255,255,0,0.5]));
function filter(){
var layerDefinitions = [];
//var selectBusiness = dojo.byId('selectBusiness');
//var selectCategory = dojo.byId('selectCategory');
layerDefinitions[0] = myQuery.where;
railLocationsLayer.setLayerDefinitions(layerDefinitions);
console.log(railLocationsLayer.layerDefinitions);
console.log("after query");
}
//IT NEVER MAKES IT THIS FAR
function showResults(featureSet)
{ console.log("inside ShowResults");
map.graphics.clear();
var graphicsArray = [];
var resultFeatures = featureSet.features;
var railLocationTemplate = new InfoTemplate("Shop Location",
"<b>Shop Name: </b>${NAME}<br/>" + "<b>Address: </b>${ADDRESS1}<br/>" );
//featureSet.setInfoTemplate(railLocationTemplate);
//Loop through each feature returned
for (var i=0, il=resultFeatures.length; i<il; i++) {
var graphic = resultFeatures;
graphic.setInfoTemplate(railLocationTemplate);
graphicsArray.push(graphic);
}
var extent = calcGraphicsExtent(graphicsArray);
map.setExtent(extent.expand(1), true).then(function(){
for(var i=0; i<graphicsArray.length; i++) {
map.graphics.add(graphicsArray);
}
});
}
function calcGraphicsExtent(graphicsArray)
{
var g = graphicsArray[0].geometry,
fullExt = g.getExtent(),
ext, i, il = graphicsArray.length;
if (fullExt === null) {
fullExt = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
for (i=1; i<il; i++) {
ext = (g = graphicsArray.geometry).getExtent();
if (ext === null) {
ext = new Extent(g.x, g.y, g.x, g.y, g.spatialReference);
}
fullExt = fullExt.union(ext);
}
return fullExt;
}