Select to view content in your preferred language

How to identify and return unique in the popup

446
0
08-13-2012 11:43 AM
ConnieLeung
Occasional Contributor
Hi,

How to return a set of unique values (of a certain attribute/ column) upon identified results?

Below is my code in the mapClick event

------------------------------------------------------------------------------

      var identifyTask = new esri.tasks.IdentifyTask(this.querylayer.map.url);

      var identifyParams = new esri.tasks.IdentifyParameters();
      identifyParams.tolerance = 3;
      identifyParams.returnGeometry = true;
      identifyParams.layerIds = [2];
      identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
      identifyParams.width  = this.map.width;
      identifyParams.height = this.map.height; 
      identifyParams.mapExtent = this.map.extent;   
      identifyParams.layerDefinitions = [];
      identifyParams.layerDefinitions[2]=this.mapAwardsLayer.layerDefinitions[2];
      identifyParams.geometry = evt.mapPoint;
      var deferred = identifyTask.execute(identifyParams);
      deferred.addCallback(function(response) {    
          // response is an array of identify result objects   
          // Let's return an array of features.         
            return dojo.map(response, function(result) {
              var feature = result.feature;
                var template = new esri.InfoTemplate();
                feature.setInfoTemplate(template);
              var record = feature.attributes;
             var popKey = record.PleaceOfPerformanceKey;
             var name = record.NAME;
        template.setContent("<b>"+name + "</b><br />" );                      
              return feature;
          });
        });
        this.map.infoWindow.setFeatures([ deferred ]);
        this.map.infoWindow.resize(220,100);
        this.map.infoWindow.show(this.map.toScreen(evt.mapPoint));
0 Kudos
0 Replies