function getProjectReport(theFid) { var theParam = theFid.split(","); var query = new esri.tasks.Query(); query.where = "FID=" + theParam[0]; query.outFields = ["*"]; query.returnGeometry = true; var theGraphic; //Specify the appropriate point/line map service depending on what was clicked switch (theParam[1]) { case "point": var queryTask = new esri.tasks.QueryTask("URL #1"); break; case "polyline": var queryTask = new esri.tasks.QueryTask("URL #2"); break; } queryTask.execute(query,function(featureSet) { dojo.forEach(featureSet.features, function(feature) { theGraphic = feature; }); }); console.log(theGraphic.attributes.PROJECT); }
Solved! Go to Solution.
function getProjectReport2(param) { var theParam = param.split(","); var theShape; var query = new esri.tasks.Query(); query.where = "FID=" + theParam[0]; query.outFields = ["*"]; query.returnGeometry = true; //Specify the appropriate point/line map service depending on what was clicked switch (theParam[1]) { case "point": var queryTask = new esri.tasks.QueryTask("http://dmc-arcgis.snoco.co.snohomish.wa.us/SnocoGISdev/rest/services/transportation/tipProjectsPoint/MapServer/0"); break; case "polyline": var queryTask = new esri.tasks.QueryTask("URL to Map Servce"); break; } //The new browser window must be opened in the function called by the 'onClick' event so //the new window is created here and its associated variable is created with a global scope. //Calculate the center of the screen for placement of the new window var center_left = (screen.width / 2) - (1000 / 2); var center_top = (screen.height / 2) - (600 / 2); newWindow = window.open('','mywindow','width=1000,height=600,menubar=yes,scrollbars=yes,left=' + center_left + ',top=' + center_top); var dQuery = queryTask.execute(query,createDeferredResults); }
function createDeferredResults(featureSet) { var dTractRace, dTractIncome, dTractLep; dojo.forEach(featureSet.features, function(feature) { theTipProject = feature; }); var query = new esri.tasks.Query(); query.outFields = ["*"]; query.returnGeometry = true; query.geometry = theTipProject.geometry; qTractRace = new esri.tasks.QueryTask("URL Service #1"); qTractIncome = new esri.tasks.QueryTask("URL Service #2"); qTractLep = new esri.tasks.QueryTask("URL Service #3"); dTractRace = qTractRace.execute(query); dTractIncome = qTractIncome.execute(query); dTractLep = qTractLep.execute(query); defQuery = new dojo.DeferredList([dTractRace,dTractIncome,dTractLep]); defQuery.then(handleCensusResults); }
function handleCensusResults(results) { var raceResults, incomeResults, lepResults; raceResults = results[0][1].features; incomeResults = results[1][1].features; lepResults = results[2][1].features; . . . processRaceResults(raceResults); }