HiLooks like your query is correct and i presume you can see the query execute if you use firebug or similar?try the below, you need to take the results and do something with them. I pass it to the showResults function, build a table and zoom to the location on the map.//execute query
queryTask.execute(query0, showResults);
};
function showResults(results) {
var s = "<table>";
var aliases = results.fieldAliases;
var len = results.features.length;
var fieldTypes = {};
//var dateI = results.fields.length;
// define a variable that will hold the field type for each field name.
array.forEach(results.fields, function (aField) {
fieldTypes[aField.name] = aField.type;
});
if (len === 0) { // if no results
s = "No results for IPMS reference: " + IPMSREF
} else { // if 1 or more results, display them
for (var i = 0; i < len; i++) {
var featureAttributes = results.features.attributes;
for (var att in featureAttributes) {
//var aliasesFix = aliases[att].replace("*", "")
if (featureAttributes[att] == null) {
featureAttributes[att] = ""
}
else if (fieldTypes[att] == "esriFieldTypeDate") {
featureAttributes[att] = formatDate(new Date(featureAttributes[att]));
}
else if (fieldTypes[att] == "esriFieldTypeDouble") {
featureAttributes[att] = Math.round(featureAttributes[att]*10000)/10000
}
else if (att == "EDITEDBY" && "CREATEDBY") {
featureAttributes[att] = featureAttributes[att].replace("IPS$","");
}
s = s + "<tr><td><span style='white-space: nowrap'>" + "<b>" + (aliases.hasOwnProperty(att) && aliases[att]) + "</b>" + ": " + "</td><td style='width:100%;'>" + featureAttributes[att] + "</td></tr>";
}
s = s + "<tr class='blank_row'><td></td>"
}
s = s + "</table><br />";
};
dom.byId("info").innerHTML = s;
dojo.query("#info table tr:nth-child(odd)").addClass("odd");
dojo.query("#info table tr:nth-child(even)").addClass("even");
//get x and y from centre of results geometry = true query
var polyGonGeom = results.features[0].geometry;
var polyGonExt = polyGonGeom.getExtent();
map.setExtent(polyGonExt);
var Polygon = new esri.geometry.Polygon(polyGonGeom, new esri.SpatialReference({
wkid: 27700
}));
console.log(Polygon)
if (!graphic) {
addGraphic(Polygon);
} else {
graphic.setGeometry(Polygon);
};
};
//add graphic to the map
function addGraphic(Polygon) {
//parameters for the symbol
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([49, 101, 156]), 2), new dojo.Color([148, 186, 231, 0.5]));
// var symbol = new esri.symbol.PictureMarkerSymbol({
// "angle": 0,
// "xoffset": 0,
// "yoffset": 0,
// "type": "esriPMS",
// "url": "http://static.arcgis.com/images/Symbols/Basic/BlueShinyPin.png",
// "contentType": "image/png",
// "width": 24,
// "height": 24
// });
var graphic = new esri.Graphic(Polygon, symbol);
map.graphics.add(graphic);
};