Hi Robert,
I'm trying to get the graphic for each parcel returned from the rest service set to a variable, pass that variable as part of an object and add the graphic to the map, however I seem to be missing something, most likely related to dojo/Deferred. The code below seems to work, but if I uncomment line 33, I get "Reference Error: graphic is not defined". If I comment out line 20 and uncomment line 21, all the parcels are black, and the symbolColor, while correct in the console.log(line 9), has NaN for the RGB values in the console.info(line 22).
_requestSucceeded: function(response){
for(var i = 0, len = response.length; i < len; i++){
var accountNum = response[i].AccountNum;
var include = response[i].Include;
var symbolColor = response[i].SymbolColor;
var def = new Deferred();
console.log(symbolColor);
var queryString = "AccountNum = " + response[i].AccountNum;
var query = new Query();
var queryTask = new QueryTask("arcgis/rest/services/Dynamic/AccountNumber/MapServer/0");
query.where = queryString;
query.returnGeometry = true;
queryTask.execute(query, lang.hitch(this, function(results){
var features = results.features;
for(var i = 0, len = features.length; i < len; i++){
var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2), new Color([255,255,0,0.25]));
console.info(symbol);
var graphic = features[i];
graphic.setSymbol(symbol);
this.map.graphics.add(graphic);
}
def.resolve({state: 'success', value: results});
}), lang.hitch(this, function(error){
def.resolve({state: 'failure', value: error});
}));
this.list.add({
accountNum: accountNum,
include: include,
symbolColor: symbolColor
});
}
}
William