I have a config file consisting of multiple rest endpoint urls and various where clauses. This allows the app to query for a value across multiple rest endpoints (can be 1 or as many as 10) with one or more fields (as many as 4).
I am putting the urls and where clauses in an array and then looping through each, firing off a QueryTask for each:
for (q = 0; q < layerIDs.length; q++) {
var queryTask = new esriQueryTask(layerIDs);
var query = new esriQuery();
query.returnGeometry = true;
query.outSpatialReference = {wkid:102100};
query.outFields = [ '*' ];
query.where = queryWheres;
queryTask.execute(query, queryResults, queryError);
}
For the results, I am getting the results.features.geometry and throwing the graphics on the map. All this works well
var selections = results.features;
array.forEach(selections, function(feat) {
feat.setSymbol(new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, null, new Color([175,0,0,0.50])));
map.graphics.add(feat);
});
if (selections.length == 0) {
smess.set("value", "No results found for the query.");
} else if (selections.length == 1 && selections[0].geometry.type == "point") {
map.centerAndZoom( selections[0].geometry, 20);
} else {
var extent = GraphicsUtils.graphicsExtent(selections);
map.setExtent(extent.expand(1.25));
}
However, if the results return more than one feature, I put the attributes in a ContentPane within a Container (Tab or Accordion). This I can do but I need to have the title for ContentPane to be something intelligent - preferably the mapserver name. I can use results.displayFieldName but that's nothing useful. I don't see anything in results beyond attributes and geometry.
var resPane = new ContentPane({
title: ???results.displayFieldName??? + " (" + results.features.length + ")",
content: grid
});
Is there a way (without running each QueryTask in a promise and having to hardcode each result) that I can get more information in the results from its QueryTask?