<?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: Access feature attribute from infoWindow click. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451573#M41734</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure I completely understand the scenario either - and it looks like Robert also hit on this point - but you can set up a map click event to grab the feature's graphic, which contains its attributes, then send the desired attribute value to your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;map.on("click", function(evt){
&amp;nbsp; //if you click a graphic, grab the desired attribute
&amp;nbsp; if(evt.graphic){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var yourVariable = evt.graphic.attributes.FIELDNAME;
&amp;nbsp; }
&amp;nbsp; else{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp; }

&amp;nbsp; //send yourVariable to queryTask
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this the type of workflow you're looking for, or are you trying to grab an attribute value by clicking it inside an infoWindow?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:09:06 GMT</pubDate>
    <dc:creator>KristianEkenes</dc:creator>
    <dc:date>2021-12-11T20:09:06Z</dc:date>
    <item>
      <title>Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451568#M41729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a continuation from a few other threads-&lt;A href="https://community.esri.com/message/546495"&gt;Re: Combine line and point feature classes attributes&lt;/A&gt;&amp;nbsp; &lt;A href="https://community.esri.com/message/444356"&gt;How to query features and populate a line graph in bottom pane with analysis&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are trying to figure out how to access a feature attribute from a "simple click". In the past I was accessing a feature attribute by assigning it a variable, ex. hydrantRecord = evt.graphic.attributes.HydrantID . I did this after a selection was made with the attribute inspector and before it went to a series of relationship queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the question is, what is the simplest way to access a feature attribute and assign it to a variable without popups or info windows?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 14:55:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451568#M41729</guid>
      <dc:creator>williamcarr</dc:creator>
      <dc:date>2015-08-27T14:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451569#M41730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;So the question is, what is the simplest way to access a feature attribute and assign it to a variable without popups or info windows?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You would have to use a QueryTask and Query to get a feature unless you have access to the feature from a FeatureLayer selection or something. Or did I completely mis-interpert the question?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 15:08:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451569#M41730</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-08-27T15:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451570#M41731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should be more specific. We are trying to have a feature on a map that the user can click on, after it is clicked the selected feature attribute is stored as a variable. This variable would then be used in a query to create an array of a Dojo chart(We got this part handled.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jssamples/popup_chart.html" title="https://developers.arcgis.com/javascript/jssamples/popup_chart.html"&gt;Popup | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, this popup example accesses attribute information, but the code doesn't show any click/selection code. I assume that there is a way to setFeatures, feature.attributes or access a feature index somehow. Not sure how.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 15:59:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451570#M41731</guid>
      <dc:creator>williamcarr</dc:creator>
      <dc:date>2015-08-27T15:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451571#M41732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; OK, under the hood of the API the the fact that the FeatureLayer has a &lt;SPAN class="pln"&gt;infoTemplate defined it just does a Query/Selection based on the map click point to see if the map click hits a feature. So if you do not want to use popups when the feature is clicked then you just do the same thing.&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN class="pln"&gt;Add a map click event and fire off a QueryTask using the map click event expanded by a defined tolerance to an extent geometry and use that extent as the Querys geometry or the FeatureLayers selectFeatures Method.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="pln"&gt;The results of the query will have the attribute for you to work with.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 17:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451571#M41732</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-08-27T17:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451572#M41733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I made some progress with this example: &lt;A href="https://developers.arcgis.com/javascript/jssamples/ed_relatededits.html" title="https://developers.arcgis.com/javascript/jssamples/ed_relatededits.html"&gt;Query and edit related records | ArcGIS API for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;It has the on click event we were looking for "&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;incidentLayer&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;on&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="str" style="color: #dd1144;"&gt;"click"&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #333333; font-weight: bold;"&gt;function&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt;evt&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #595959;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;{" along with the relationship query I am looking for I think.&amp;nbsp; This creates a popup with the query results instead of the graph that I want, which shouldnt be too hard to figure out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pun" style="color: #666600;"&gt;I am going to try to piece this together and see if I have any luck.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 20:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451572#M41733</guid>
      <dc:creator>MathewSuran</dc:creator>
      <dc:date>2015-08-27T20:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451573#M41734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;William,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure I completely understand the scenario either - and it looks like Robert also hit on this point - but you can set up a map click event to grab the feature's graphic, which contains its attributes, then send the desired attribute value to your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;map.on("click", function(evt){
&amp;nbsp; //if you click a graphic, grab the desired attribute
&amp;nbsp; if(evt.graphic){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var yourVariable = evt.graphic.attributes.FIELDNAME;
&amp;nbsp; }
&amp;nbsp; else{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return;
&amp;nbsp; }

&amp;nbsp; //send yourVariable to queryTask
});&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this the type of workflow you're looking for, or are you trying to grab an attribute value by clicking it inside an infoWindow?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:09:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451573#M41734</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2021-12-11T20:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451574#M41735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mathew, are you sure you still need a relationship?&lt;/P&gt;&lt;P&gt;It seems this queryTask might be easier to return your array.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451574#M41735</guid>
      <dc:creator>williamcarr</dc:creator>
      <dc:date>2015-08-28T11:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451575#M41736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the delay, just getting back on this.&amp;nbsp; So if I don't need the relationship class in the gdb, then would I have to load both feature services and just not display one?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 13:39:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451575#M41736</guid>
      <dc:creator>MathewSuran</dc:creator>
      <dc:date>2015-09-01T13:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Access feature attribute from infoWindow click.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451576#M41737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will have to load both feature services, regardless of whether or not you use a relate. It just depends which way you might want go-- relationship query or select a point and query with the selected point attribute.&lt;/P&gt;&lt;P&gt;I'm actually updating my app to use the select and query option for an actual map rather than my previous map-less ui. I'll let you know when I hit paydirt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 19:55:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-feature-attribute-from-infowindow-click/m-p/451576#M41737</guid>
      <dc:creator>williamcarr</dc:creator>
      <dc:date>2015-09-01T19:55:35Z</dc:date>
    </item>
  </channel>
</rss>

