dexconor

Something wrong with my Query function

Discussion created by dexconor on Apr 21, 2014
Latest reply on Apr 21, 2014 by jeff.pace
 queryTask = new esri.tasks.QueryTask(url);
    query = new esri.tasks.Query();
    query.returnGeometry = true;
    query.outSpatialReference = new esri.SpatialReference(102100);
        query.where = "Number = '" + bldgV + "'";
        queryTask.execute(query, onResults);

function onResults(results) {
    //map.graphics.clear();
    var geom = results.features[0].geometry;
    if (!geom) {
        alert("No result")
    };
  //alert(results.features[0]);
    var extent = geom.getExtent();
    var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
    var graphic = results.features[0];
    graphic.setSymbol(symbol);
    map.graphics.add(graphic);
    map.setExtent(extent, true);
 console.log(results.features[0]);

}


So this work working fine totally, since I didn't touch the code

now it work when I
block //map.graphics.clear();
and turn alert(results.features[0]); this on

Can anyone think what might be the problem?

Thanks for reading

Outcomes