AnsweredAssumed Answered

Obtaining individual field alias from query resutls

Question asked by GibbyAR on Sep 26, 2013
Latest reply on Sep 27, 2013 by GibbyAR
Trying to obtain an individual field alias from results returned from a query. I can see the list of field aliases for an object (in the "results" object) but not sure how to get the individual alias value for a field. Hope that makes sense. Code is below....where "att" is the variable containing the actual field name. In this case the feature has three fields which are aliased. I know I could set up a switch to evaluate the value of the "att" variable but there exists the potential to have as many as 50 fields.

function showQueryResults(results) {
       dom.byId("facilityDetailDiv").innerHTML = "";
          var s = "";
          for (var i=0, il=results.features.length; i<il; i++) {      
            var featureAttributes = results.features[i].attributes;
            for (att in featureAttributes) {     
              s = s + "<b>" + att + ":" + featureAttributes[att] + "<br>";
            }
            s = s + "<br>";
          }        
    dom.byId("facilityDetailDiv").innerHTML = s;  
        }

Outcomes