<?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: getting the attribute field value for rendering in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306590#M28138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Maybe try specifying the field Alias?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Off the top of my head I think you're right - the alias will be the value to use in this case "Public Safety Exp".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Whenever I accessed the attributes of results, I used the format of features[0].attributes.&amp;lt;the attribute Field Name&amp;gt;". Note the use of a period instead of array brackets ( [ ] ). Like all things Javascript, the field name WILL be case sensitive.&lt;BR /&gt;&lt;BR /&gt;You could also try quoting the field name in your specification: features[0].attributes['&amp;lt;the attribute field name&amp;gt;']&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that the dot notation won't work for attributes that have a space (or a dot I suppose!) in their name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Safer to use square bracket notation for accessing associative arrays e.g. features[0].attributes["Public Safety Exp"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could stick a breakpoint in your code then peruse the attributes in a watch or you could stick some code in to log all the attribute names (and values if you like) to the console, I posted some code in another thread that will do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Assumes you're using an up-to-date browser!
console.log(Object.keys(features[0].attributes));
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:40:37 GMT</pubDate>
    <dc:creator>__Rich_</dc:creator>
    <dc:date>2021-12-11T14:40:37Z</dc:date>
    <item>
      <title>getting the attribute field value for rendering</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306588#M28136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am working on a map application that similar to the example &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/samples/renderer_equal_interval/index.html"&gt;"Calculate equal interval class breaks"&lt;/A&gt;&lt;SPAN&gt; . but I have difficulties of retrieving the value of the attribute field, when I use the "features[0].attributes[attributeField]" same as the example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The field I am trying to access is named "sqldb27.SDE.afr_2010.publicSafety_e (Type: esriFieldTypeInteger, Alias: Public Safety Exp)".I suspect the problem maybe caused by the periods in my attribute filed name. However, the attribute name was generated when I joined several tables, and I am not quite sure how to get rid of the periods in there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lu&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 15:17:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306588#M28136</guid>
      <dc:creator>LuhuaCai</dc:creator>
      <dc:date>2012-11-01T15:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: getting the attribute field value for rendering</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306589#M28137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe try specifying the field Alias?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Whenever I accessed the attributes of results, I used the format of features[0].attributes.&amp;lt;the attribute Field Name&amp;gt;". Note the use of a period instead of array brackets ( [ ] ). Like all things Javascript, the field name WILL be case sensitive.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could also try quoting the field name in your specification: features[0].attributes['&amp;lt;the attribute field name&amp;gt;']&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 16:48:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306589#M28137</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2012-11-01T16:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: getting the attribute field value for rendering</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306590#M28138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Maybe try specifying the field Alias?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Off the top of my head I think you're right - the alias will be the value to use in this case "Public Safety Exp".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Whenever I accessed the attributes of results, I used the format of features[0].attributes.&amp;lt;the attribute Field Name&amp;gt;". Note the use of a period instead of array brackets ( [ ] ). Like all things Javascript, the field name WILL be case sensitive.&lt;BR /&gt;&lt;BR /&gt;You could also try quoting the field name in your specification: features[0].attributes['&amp;lt;the attribute field name&amp;gt;']&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that the dot notation won't work for attributes that have a space (or a dot I suppose!) in their name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Safer to use square bracket notation for accessing associative arrays e.g. features[0].attributes["Public Safety Exp"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could stick a breakpoint in your code then peruse the attributes in a watch or you could stick some code in to log all the attribute names (and values if you like) to the console, I posted some code in another thread that will do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Assumes you're using an up-to-date browser!
console.log(Object.keys(features[0].attributes));
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:40:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-the-attribute-field-value-for-rendering/m-p/306590#M28138</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2021-12-11T14:40:37Z</dc:date>
    </item>
  </channel>
</rss>

