My javascript code is below. The geoprocessing task runs correctly and outputs a Table (not a feature class). Unfortunately the results aren't getting passed to the callback function. <script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Dialog");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("esri.map");
dojo.require("esri.tasks.gp");
//Define global variables here.
var map;
var loading;
var gp;
function init() {
loading = dojo.byId("loadingImg");
var initExtent = new esri.geometry.Extent({"xmin":-9215700,"ymin":3216400,"xmax":-9119800,"ymax":3256100,"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:initExtent});
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.
//Cached Maps
//Add the world street map layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(basemap);
var eluMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://gis.tpcmaps.org/ArcGIS/rest/services/LandUse/Existing_Land_Use/MapServer", {"opacity":0.5, "imageParameters":imageParameters});
map.addLayer(eluMapServiceLayer);
var parcelMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://gis.tpcmaps.org/ArcGIS/rest/services/Parcels/MapServer", {"opacity":1.0, "imageParameters":imageParameters});
map.addLayer(parcelMapServiceLayer);
dojo.connect(map, 'onLoad', function(theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
}
dojo.addOnLoad(init);
function getLuLc() {
//Geoprocessing Task
gp = new esri.tasks.Geoprocessor("http://gis.tpcmaps.org/ArcGIS/rest/services/ServerTools/GPServer/LuByFolioId");
console.log("inside getLuLc");
console.log(dojo.byId("folio").value);
//var params = { folioID: dojo.byId("folio").value };
var params = { folioID: "191001.0000" };
// SHOW LOADING DIALOG
dijit.byId('loadingDialog').show();
gp.submitJob(params, completeCallback, statusCallback);
console.log("after submitJob call");
}
function statusCallback(jobInfo) {
var status = jobInfo.jobStatus;
}
function completeCallback(jobInfo){
console.log("inside completeCallback");
var status = jobInfo.jobStatus;
console.log(status);
if(status === "esriJobFailed"){
// HIDE LOADING DIALOG
dijit.byId('loadingDialog').hide();
}
else if (status === "esriJobSucceeded"){
console.log("success, jobId:" + jobInfo.jobId);
// HIDE LOADING DIALOG
dijit.byId('loadingDialog').hide();
console.log("getting data");
//gp.getResultData(jobInfo.jobId,"Output_Zip_File", downloadFile);
gp.getResultData(jobInfo.jobId, "OutputTable", displayResult, displayError);
console.log("after getting result data");
}
}
function displayResult(results, messages) {
console.log("inside displayResult");
var resultFeatures = results.features;
console.log("feature count: " + resultFeatures.length);
}
function displayError(results, messages) {
alert("error in getResultData");
}
The callback function displayResult is getting invoked, but the console gives the error that "resultFeatures" is undefined:TypeError: resultFeatures is undefineddisplayResult(undefined="[object Object]")MySample.html (line 98)(undefined="[object Array]", undefined=""onGetResultDataComplete"", undefined="displayResult", undefined="[object Object]")?v=3.0 (line 34)(undefined="[object Object]", undefined="[object Object]", undefined="displayResult", undefined="displayError", undefined="[object Object]")?v=3.0 (line 34)(undefined="[object Object]", undefined="[object Object]", undefined="displayResult", undefined="displayError", undefined="[object Object]")?v=3.0 (line 15)(undefined="[object Object]", undefined="[object Object]")?v=3.0 (line 34)(undefined="[object Object]")Do I have to output a feature class instead of a table for this to work? What am I missing?Thanks in advance,Joan