Arkitech

Querytask refresh

Discussion created by Arkitech on Aug 1, 2012
Any idea how i can set the querytask to refresh ever 30 seconds or so (for testing?). I want to populate a html element with the latest results from my query every 2 mins or whenever

I was thinking of using a setinterval but the task is not a function

Any help please ?

 var queryTask = new esri.tasks.QueryTask(layer.ServiceUrl);
            var query = new esri.tasks.Query();
            query.where = "EDIT_DATE < sysdate";
            query.returnGeometry = false;
            query.outFields = ["EDIT_DATE", "DIVISION", "PARTY_NEW"];
            queryTask.execute(query, function (featureSet) {             
                var s = "";
    var date = new js.date();
                for (var i=0, il=featureSet.features.length; i<il; i++) {
      var utcMilliseconds = Number(featureSet.features[i].attributes[updates.FieldName]);
      featureSet.features[i].attributes[updates.FieldName] = dojo.date.locale.format(date.utcToLocal(date.utcTimestampFromMs(utcMilliseconds)), { datePattern: updates.FormatDateAs, timePattern: updates.FormatTimeAs });
      var featureAttributes = featureSet.features[i].attributes;
      //var featureAlias = featureSet.fields[0].alias
     for (att in featureAttributes) {
      s = s + "<b>" + att + ":</b>  " + featureAttributes[att] + "<br />";
     }
    }
    

    dojo.byId("tdLastUpdate").innerHTML = s;  

Outcomes