My goal is to loop through the results of a query task and return only the graphics that match the returned query records.
I have created a query task that queries a table and returns the matching set of results. I then created a graphics layers with attributes from a points feature class. So I now have to arrays that I need to loop through and only show the points that are in both. I am using graphics since variations of this query will be repeated many times. My show results function is working except it only returns the first matched individual graphic and not the whole set. Just started developing again and am probably missing something very basic.
My code is:
// Function to show the shots that were returned in the table query (attached to graphics)
function showResults(results) {
dojo.forEach(results.features, function (resultsFeature) {
dojo.forEach(shotLayer.graphics, function (shotLayerGraphic) {
if (resultsFeature.attributes.LOC == shotLayerGraphic.attributes.Path) {
shot.show();
alert("test"+ resultsFeature.attributes.LOC "and" + shotLayerGraphic.attributes.Path);
}
});
});
}
The alert lets me know that it is cycling through correctly, but shot.show(); only displays one point.
My graphics layer is shotLayer and the individual graphics is the shot variable (both declared globally)
Any help would be greatly appreciated