<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Avoid hardcoding column name on result? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/avoid-hardcoding-column-name-on-result/m-p/612453#M57278</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;console.log("name: " + attr[displayName]);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your example code that fails is looking for a property named "displayName" on the attr object. The syntax I used lets you specify a property name as a string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Feb 2011 00:09:21 GMT</pubDate>
    <dc:creator>derekswingley1</dc:creator>
    <dc:date>2011-02-07T00:09:21Z</dc:date>
    <item>
      <title>Avoid hardcoding column name on result?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/avoid-hardcoding-column-name-on-result/m-p/612452#M57277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&amp;nbsp; My query.outFields works fine, but I can't get the results using the variable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
query.outFields = ["ID", "STATE", displayColumn];

for (var i=0; i&amp;lt;numFeatures; i++) {
&amp;nbsp;&amp;nbsp; var graphic = fset.features&lt;I&gt;;
&amp;nbsp;&amp;nbsp; var attr = fset.features&lt;I&gt;.attributes;

&amp;nbsp;&amp;nbsp; // works: console.log("name: " + attr.NAME;
&amp;nbsp;&amp;nbsp; // fails: console.log("name: " + attr.displayColumn;
...
&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Glen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Feb 2011 13:15:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/avoid-hardcoding-column-name-on-result/m-p/612452#M57277</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2011-02-05T13:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Avoid hardcoding column name on result?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/avoid-hardcoding-column-name-on-result/m-p/612453#M57278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;console.log("name: " + attr[displayName]);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your example code that fails is looking for a property named "displayName" on the attr object. The syntax I used lets you specify a property name as a string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Feb 2011 00:09:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/avoid-hardcoding-column-name-on-result/m-p/612453#M57278</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2011-02-07T00:09:21Z</dc:date>
    </item>
  </channel>
</rss>

