Avoid hardcoding column name on result?

Discussion created by glenreid on Feb 5, 2011
Latest reply on Feb 6, 2011 by DSwingley-esristaff
On a query result, is there a way to avoid having to use the actual column name? I have the desired column in a variable (displayColumn) which changes based on user selections.  My query.outFields works fine, but I can't get the results using the variable:

query.outFields = ["ID", "STATE", displayColumn];

for (var i=0; i<numFeatures; i++) {
   var graphic = fset.features[i];
   var attr = fset.features[i].attributes;

   // works: console.log("name: " + attr.NAME;
   // fails: console.log("name: " + attr.displayColumn;