Select to view content in your preferred language

attribute coded value shown as 'undefined' in infoWindow

4025
12
10-19-2012 10:06 AM
deleted-user-ugCMpXci8bn5
Deactivated User
Hello,

I have a tabbed infoWindow in my web app (using v3.2, Server10.0).  The field in question uses a coded value (integers, corresponding to strings).
The problem is that this field is shown as 'undefined' in the infoWindow, rather than either the range or dmoain value.
This tabbed infoWindow is built based on this example:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

There is a fair amount of code involved in the tabbed structure..I'll post what I think is the most relevant below..

ideas? Thanks! // Jason

Identify Task and Params:
    function initFunctionality(map) 
    {
        dojo.connect(map, "onClick", doIdentify);

        identifyTask = new esri.tasks.IdentifyTask("http://" + mapDomain + "/ArcGIS/rest/services/mapServer");

        identifyParams = new esri.tasks.IdentifyParameters();
        identifyParams.tolerance = 10;
        identifyParams.returnGeometry = true;
        identifyParams.layerIds = ssLayer.visibleLayers;
        identifyParams.layerOption = "all";
        identifyParams.width = map.width;
        identifyParams.height = map.height;

        map.infoWindow.resize(415, 200);
        map.infoWindow.setContent("");
        map.infoWindow.setTitle("");
        map.infoWindow.setContent(dijit.byId("tabs").domNode);
        map.infoWindow.setTitle("Identify Results");
}



infoWindow layout:
               
                    if ((layerResults.features.length > 0) && (orgOn != 0)) {
     dijit.byId("tabs").selectChild("orgTab");
                    content = "<i>Total features returned: " + layerResults.features.length + "</i>";
                    content += "<table border='1'><tr><th>Name</th><th>Address</th><th>BIN</th><th>Category</th></tr>";
                    for (var i = 0, il = layerResults.features.length; i < il; i++) {
                        content += "<tr><td>" + layerResults.features.attributes['Name'] + "</td>"; // works fine
                        content += "<td>" + layerResults.features.attributes['Address'] + "</td>"; // works fine
                        content += "<td>" + layerResults.features.attributes['CodedValue'] + "</td>"; 
                        // this line returns 'undefined' /// 
                             
                    }
                    content += "</tr></table>";

}
0 Kudos
12 Replies
deleted-user-ugCMpXci8bn5
Deactivated User
Yes, I can make a new thread if needed, but I will respond to your last post.
In this case I am trying to access the value for 'Bldg_name" and 'ZIP"...
I'm not sure what you mean by 'the only attribute for the feature is Site_name".  The layer has several attributes, and I can access them using IdentifyTask info Window but I get a return of 'undefined' here (see code below, this prints the returned values to a content pane'.
I 'watched' resultFeatures.attributes['Site_name'] and resultFeatures.attributes['Bldg_name']...Site_name returns the expected value (the name of the site), but bldg_name returns undefined in Firebug..but in an infoWindow this same field returns a string.

here is the code, and thanks for your help // Jason

         for (var i = 0, l = 5; i < l; i++)
          {

        locContent += "<tr><td>" + resultFeatures.attributes['Site_name'] + "</td>";
        locContent += "<tr><td>" +  resultFeatures.attributes['Bldg_name'] + "</td>";
               locContent += "<td>" +  resultFeatures.attributes['ZIP'] + "</td>"; 
               //console.log(Object.keys(fset.features.attributes));
  
          }
          locContent += "</tr></table>";
          dojo.byId("closestSchoolResults").innerHTML = locContent;
0 Kudos
__Rich_
Deactivated User

I'm not sure what you mean by 'the only attribute for the feature is Site_name".

Because earlier, you said:
I tried that console message you gave above, and the only return was 'Site_name'


This is getting confusing...
0 Kudos
deleted-user-ugCMpXci8bn5
Deactivated User
I found this ESRI example that was helpful....it shows how to extract the coded values, and in a pinch can be used as a standalone to get these values for hard-coding...http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/data_requestLa...
0 Kudos