Select to view content in your preferred language

Error when trying to return query results

639
1
Jump to solution
09-12-2013 01:09 PM
KennethRichards
Occasional Contributor
Everytime I try to run my query I get
Error {code: 400, message: "Unable to complete  operation.", details: Array[1], log: undefined, httpCode: 400}  init.js

From what I understand this is a pretty generic error so I don't have much to work with.
Can anyone with a little more experience see what is causing the error?

require(["dojox/grid/DataGrid", "dojo/ready",     "esri/tasks/query","esri/tasks/QueryTask",     "dojo/dom","dojo/on","dojo/domReady!"], function(DataGrid,ready,Query,QueryTask,dom,on){     ready(function(){     var myQueryTask, myQuery;     myQueryTask = new QueryTask("http://services.azgs.az.gov/ArcGIS/rest/services/aasggeothermal/AZWellHeaders/MapServer/0");      myQuery = new Query();     myQuery.returnGeometry = false;     myQuery.outFeilds = ["*"]     function runQuery(){     var apiNo = dom.byId('apinum').value;     var otherId = dom.byId('stateperm');       myQuery.where ="apino like '%" + apiNo + "%'" + "OR" + "otherid like '%" + otherId + "%'";     myQueryTask.execute(myQuery,showResults);  } function showResults(myFeatures){     console.log(myFeatures);     var s = "";           for (var i=0, il=myFeatures.features.length; i < il; i++) {             var featureAttributes = myFeatures.features.attributes;             for (att in featureAttributes) {               s = s + "<strong>" + att + ": </strong>" + featureAttributes[att] + "<br />";             }           }           dojo.byId("info").innerHTML = s;  } on(dom.byId("executeButton"), "click", runQuery);     }); });
0 Kudos
1 Solution

Accepted Solutions
ChristopherBlinn1
Deactivated User
Error code 400 means the service was unable to perform the query.

You need a space before and after OR in your where statement.

Try this:
myQuery.where ="apino like '%" + apiNo + "%'" + " OR " + "otherid like '%" + otherId + "%'";

View solution in original post

0 Kudos
1 Reply
ChristopherBlinn1
Deactivated User
Error code 400 means the service was unable to perform the query.

You need a space before and after OR in your where statement.

Try this:
myQuery.where ="apino like '%" + apiNo + "%'" + " OR " + "otherid like '%" + otherId + "%'";
0 Kudos