abrown31

Retrieving attributes of graphics

Discussion created by abrown31 on Jul 11, 2011
Latest reply on Jul 11, 2011 by abrown31
Hello all,

I'm trying to retrieve the attributes from the map graphics located on the map after an identify task is executed. It has worked in the past, but all of a sudden it stopped working. I think that it might be related to something in the MXD or the spatial database...

Here is everything executed, step by step.

I'm using an identify task to place a map.graphic at a location where a point is located:

layer contains the layerId(s), and geometry contains the geometry of the user-drawn freehand shape

function selectQueryFunction(layer, geometry){
          
          identifyParams = new esri.tasks.IdentifyParameters(); 
          identifyParams.tolerance = 3; 
          identifyParams.returnGeometry = true; 
          identifyParams.layerIds = [layer];
          identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
          identifyParams.geometry = geometry;
          identifyParams.mapExtent  = map.extent; 
          identifyParams.width  = map.width; 
          identifyParams.height = map.height; 
          identifyTask.execute(identifyParams, function(identifyResults){
          
            dojo.forEach(identifyResults, function(results){
              var graphic = results.feature;
              switch(results.geometryType){
              
                case "esriGeometryPoint":
                symbol = new esri.symbol.SimpleMarkerSymbol();
                break;
                case "esriGeometryPolygon":
                symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 2), new dojo.Color([98, 194, 204, 0.5]));
                break;
              }
              graphic.setSymbol(symbol);
              map.graphics.add(graphic);
            });
          
            });
        
      }


If I use Aptana 3's debugger for Firefox, I stopped it right as the graphic is being added to the map, and I examined the attributes. Currently, it only shows one, the shape as a point, which is correct. Previously, it displayed all of the attribute fields available for that feature, such as the name, location, site_name, etc.

Why have the additional fields stopped being added to the map graphics? I never turned anything on and off, the fields are all set to visible, including OBJECTID (which isn't visible). I previously had custom aliases, which contained spaces, and they weren't working well with the itemdatastore I had for my datagrid, so I had to revert back to the basic field name. Once I reverted back, this started happening.

I even restarted the mapping service based on a brand new MXD, with layers being added via ArcCatalog and resymbolized. Previously, there were no attribute fields (seen via the debugger), but now I am so fortunate to have the "shape" field.

Please help... this viewer is supposed to be completed this week and all of a sudden this started happening.

Thanks,
Andrew

Outcomes