AnsweredAssumed Answered

queryTask.execute Fails

Question asked by jamesfreddyc on Apr 27, 2018
Latest reply on Apr 27, 2018 by jamesfreddyc

I'm getting a ReferenceError "results is not defined" on the queryTask.execute:


   //first, check to see if a workplan boundary exists            
    if (this.workplanId) {
     var queryUrl = "https://somewebsite/someagssite/rest/services/folder/servicename/FeatureServer/0"           
     var queryTask = new QueryTask(queryUrl);
     var query = new Query();
     query.returnGeometry = true;
     query.where = "workplanId ='" + this.workplanId + "'";

     queryTask.execute(query).then(function (results) {
         this.workplanCheckValue = results.features.length;                       

    console.log("workplanCheck value is: ", this.workplanCheckValue)


I need to set this.workplanCheckValue to the number of features returned from the queryTask.


Any assistance appreciated!